diff --git a/app.js b/app.js index a29d67d7..f012657e 100644 --- a/app.js +++ b/app.js @@ -69,7 +69,7 @@ app.get( '/reverse', routers.reverse ); // TODO: name mapping for admin values (admin0 => country, etc) app.use(require('./middleware/renamePlacenames')()); -app.use(require('./middleware/geocodeJSON')()); +app.use(require('./middleware/geocodeJSON')(peliasConfig)); app.use(require('./middleware/sendJSON')); diff --git a/helper/geojsonify.js b/helper/geojsonify.js index 757a1e1b..5392e957 100644 --- a/helper/geojsonify.js +++ b/helper/geojsonify.js @@ -152,7 +152,7 @@ function addMetaData(src, dst) { var meta = META_MAP[src._type] || { type: src._type, source: src._type }; dst.id = src._id; - dst.type = meta.type; + dst.layer = meta.type; dst.source = meta.source; } diff --git a/middleware/geocodeJSON.js b/middleware/geocodeJSON.js index e7948cec..da6cfdf6 100644 --- a/middleware/geocodeJSON.js +++ b/middleware/geocodeJSON.js @@ -29,12 +29,12 @@ function convertToGeocodeJSON(peliasConfig, req, next) { // and then multiple licences, can be an object with one key by source. // Can be a freeform text property describing the licensing details. // Can be a URI on the server, which outlines licensing details. - req.results.geojson.geocoding.license = peliasConfig.host + '/license'; // TODO: add to config + req.results.geojson.geocoding.license = peliasConfig.host + '/license'; // OPTIONAL. Default: null. The attribution of the data. In case of multiple sources, // and then multiple attributions, can be an object with one key by source. // Can be a URI on the server, which outlines attribution details. - req.results.geojson.geocoding.attribution = peliasConfig.host + '/attribution'; // TODO: add to config + req.results.geojson.geocoding.attribution = peliasConfig.host + '/attribution'; // OPTIONAL. Default: null. The query that has been issued to trigger the // search. @@ -71,7 +71,7 @@ function addEngine(peliasConfig, geocoding) { geocoding.engine = { name: 'Pelias', author: 'Mapzen', - version: peliasConfig.version // TODO: add to config + version: peliasConfig.version }; } diff --git a/package.json b/package.json index a9c3c7e1..af788ae2 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "markdown": "0.5.0", "microtime": "1.4.0", "morgan": "1.5.2", - "pelias-config": "^0.1.4", + "pelias-config": "^1.0.1", "pelias-esclient": "0.0.25", "pelias-logger": "^0.0.8", "pelias-schema": "1.0.0", diff --git a/test/unit/helper/geojsonify.js b/test/unit/helper/geojsonify.js index fdd255fe..141c2783 100644 --- a/test/unit/helper/geojsonify.js +++ b/test/unit/helper/geojsonify.js @@ -142,7 +142,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': 'id1', - 'type': 'type1', + 'layer': 'type1', 'source': 'type1', 'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel', 'name': '\'Round Midnight Jazz and Blues Bar', @@ -173,7 +173,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': 'id2', - 'type': 'type2', + 'layer': 'type2', 'source': 'type2', 'label': 'Blues Cafe, test3, Smithfield', 'name': 'Blues Cafe', @@ -200,7 +200,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': '34633854', - 'type': 'venue', + 'layer': 'venue', 'source': 'osm', 'label': 'Empire State Building, Manhattan, NY', 'name': 'Empire State Building', @@ -251,7 +251,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': 'id1', - 'type': 'type1', + 'layer': 'type1', 'source': 'type1', 'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel' } @@ -269,7 +269,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': 'id2', - 'type': 'type2', + 'layer': 'type2', 'source': 'type2', 'label': 'Blues Cafe, test3, Smithfield' } @@ -287,7 +287,7 @@ module.exports.tests.search = function(test, common) { 'properties': { 'geocoding': { 'id': '34633854', - 'type': 'venue', + 'layer': 'venue', 'source': 'osm', 'label': 'Empire State Building, Manhattan, NY' }