Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation of highway=service, surface=paved is not symmetric #5711

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ HOOT_SERVICES_HOST=core-services
HOOT_SERVICES_PORT=8080
HOOT_NPM_INSTALL=0
```
to set any properties from 0 to 1 and then stop/start the containers.
to set any properties from 0 to 1 and then stop/start the containers.

Once the images are built and the containers are up and running, open the UI at https://localhost:8080
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ x-args: &default-args
node_version: "${NODE_VERSION}"
npm_version: "${NPM_VERSION}"
v8_version: "${V8_VERSION}"
stxxl_version: "${STXXL_VERSION}"
armadillo_version: "${ARMADILLO_VERSION}"
gdal_version: "${GDAL_VERSION}"
geos_version: "${GEOS_VERSION}"
Expand Down
82 changes: 82 additions & 0 deletions translations/test/service_road.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
var assert = require('assert'),
http = require('http'),
xml2js = require('xml2js'),
fs = require('fs'),
httpMocks = require('node-mocks-http'),
osmtogeojson = require('osmtogeojson'),
DOMParser = new require('@xmldom/xmldom').DOMParser
parser = new DOMParser();

var server = require('../TranslationServer.js');

describe('Service Road', function () {
this.timeout(5000);

// Strings used to build OSM XML features
var startNode = '<osm version="0.6" upload="true" generator="hootenanny">\
<node id="-13" lat="0.68270797876" lon="18.45141400736" >';

var startWay = '<osm version="0.6" upload="true" generator="hootenanny">\
<node id="-10" lat="0.68307256979" lon="18.45073925651" /> <node id="-13" lat="0.68270797876" lon="18.45141400736" />\
<way id="-19" >\
<nd ref="-10" /> <nd ref="-13" />';

var startArea = '<osm version="0.6" upload="true" generator="hootenanny">\
<node id="-10" lat="0.68307256979" lon="18.45073925651" /> <node id="-11" lat="0.68341620728" lon="18.45091527847" />\
<node id="-12" lat="0.68306209303" lon="18.45157116983" /> <node id="-13" lat="0.68270797876" lon="18.45141400736" />\
<way id="-19" >\
<nd ref="-10" /> <nd ref="-11" /> <nd ref="-12" /> <nd ref="-13" /> <nd ref="-10" />';

var endNode = '</node></osm>';
var endWay = '</way></osm>'; // NOTE: This is also for Areas as well

var schemas = [
// 'TDSv71',
// 'TDSv70',
// 'TDSv61',
// 'TDSv40',
// 'MGCP', // Different F_CODE and uuid
'GGDMv30'
];

schemas.forEach(schema => {
var fcode_key = (schema === 'MGCP') ? 'FCODE' : 'F_CODE';

it('should handle translation of service road with surface feature from ' + schema + ' -> osm -> ' + schema, function() {
var data = startWay + '<tag k="highway" v="service"/><tag k="name" v="Frithwood Lane"/><tag k="surface" v="paved"/><tag k="tracktype" v="grade1"/>' + endWay;
var trans_xml = server.handleInputs({osm: data, method: 'POST', translation: schema, path: '/translateTo'})
//console.log(trans_xml);
var xml = parser.parseFromString(trans_xml);

var tags = osmtogeojson(xml).features[0].properties;
assert.equal(tags[fcode_key], 'AP030');

var osm_xml = server.handleInputs({osm: trans_xml, method: 'POST', translation: schema, path: '/translateFrom'});
//console.log(osm_xml);
xml = parser.parseFromString(osm_xml);
tags = osmtogeojson(xml).features[0].properties;
assert.equal(tags['highway'], 'service');
assert.equal(tags['surface'], 'paved');
});

it('should handle translation of residential highway feature from ' + schema + ' -> osm -> ' + schema, function() {
var data = startWay
+ '<tag k="highway" v="residential"/>'
+ '<tag k="name" v="Portland Ave"/>'
+ endWay;
var trans_xml = server.handleInputs({osm: data, method: 'POST', translation: schema, path: '/translateTo'})
//console.log(trans_xml);
var xml = parser.parseFromString(trans_xml);

var tags = osmtogeojson(xml).features[0].properties;
assert.equal(tags[fcode_key], 'AP030');

var osm_xml = server.handleInputs({osm: trans_xml, method: 'POST', translation: schema, path: '/translateFrom'});
//console.log(osm_xml);
xml = parser.parseFromString(osm_xml);
tags = osmtogeojson(xml).features[0].properties;
assert.equal(tags['highway'], 'residential');
});
});

});