Browse Source

Remove geocoding block from properties in GeoJSON responses

All the attributes that were in this block are now put directly in the
GeoJSON properties object
pull/254/head
Julian Simioni 9 years ago
parent
commit
509a6a7401
  1. 10
      helper/geojsonify.js
  2. 124
      test/unit/helper/geojsonify.js

10
helper/geojsonify.js

@ -107,15 +107,13 @@ function geojsonifyPlace(details, place) {
return warning('No doc or center_point property'); return warning('No doc or center_point property');
} }
var geocoding = {}; var output = {};
addMetaData(place, geocoding); addMetaData(place, output);
addDetails(details, place, geocoding); addDetails(details, place, output);
addLabel(place, geocoding); addLabel(place, output);
var output = {};
output.geocoding = geocoding;
// map center_point for GeoJSON to work properly // map center_point for GeoJSON to work properly
// these should not show up in the final feature properties // these should not show up in the final feature properties
output.lat = parseFloat(place.center_point.lat); output.lat = parseFloat(place.center_point.lat);

124
test/unit/helper/geojsonify.js

@ -140,25 +140,23 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': 'id1',
'id': 'id1', 'layer': 'type1',
'layer': 'type1', 'source': 'type1',
'source': 'type1', 'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel',
'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel', 'name': '\'Round Midnight Jazz and Blues Bar',
'name': '\'Round Midnight Jazz and Blues Bar', 'country_a': 'GBR',
'country_a': 'GBR', 'country': 'United Kingdom',
'country': 'United Kingdom', 'region': 'Islington',
'region': 'Islington', 'region_a': 'ISL',
'region_a': 'ISL', 'county': 'Angel',
'county': 'Angel', 'localadmin': 'test1',
'localadmin': 'test1', 'locality': 'test2',
'locality': 'test2', 'neighbourhood': 'test3',
'neighbourhood': 'test3', 'category': ['food', 'nightlife'],
'category': ['food', 'nightlife'], 'housenumber': '13',
'housenumber': '13', 'street': 'Liverpool Road',
'street': 'Liverpool Road', 'postalcode': 'N1 0RW'
'postalcode': 'N1 0RW'
}
} }
}, },
{ {
@ -171,21 +169,19 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': 'id2',
'id': 'id2', 'layer': 'type2',
'layer': 'type2', 'source': 'type2',
'source': 'type2', 'label': 'Blues Cafe, test3, Smithfield',
'label': 'Blues Cafe, test3, Smithfield', 'name': 'Blues Cafe',
'name': 'Blues Cafe', 'country_a': 'GBR',
'country_a': 'GBR', 'country': 'United Kingdom',
'country': 'United Kingdom', 'region': 'City And County Of The City Of London',
'region': 'City And County Of The City Of London', 'region_a': 'COL',
'region_a': 'COL', 'county': 'Smithfield',
'county': 'Smithfield', 'localadmin': 'test1',
'localadmin': 'test1', 'locality': 'test2',
'locality': 'test2', 'neighbourhood': 'test3'
'neighbourhood': 'test3'
}
} }
}, },
{ {
@ -198,22 +194,20 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': '34633854',
'id': '34633854', 'layer': 'venue',
'layer': 'venue', 'source': 'osm',
'source': 'osm', 'label': 'Empire State Building, Manhattan, NY',
'label': 'Empire State Building, Manhattan, NY', 'name': 'Empire State Building',
'name': 'Empire State Building', 'country_a': 'USA',
'country_a': 'USA', 'country': 'United States',
'country': 'United States', 'region': 'New York',
'region': 'New York', 'region_a': 'NY',
'region_a': 'NY', 'county': 'New York',
'county': 'New York', 'localadmin': 'Manhattan',
'localadmin': 'Manhattan', 'locality': 'New York',
'locality': 'New York', 'neighbourhood': 'Koreatown',
'neighbourhood': 'Koreatown', 'category': ['tourism', 'transport']
'category': ['tourism', 'transport']
}
} }
} }
] ]
@ -249,12 +243,10 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': 'id1',
'id': 'id1', 'layer': 'type1',
'layer': 'type1', 'source': 'type1',
'source': 'type1', 'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel'
'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel'
}
} }
}, },
{ {
@ -267,12 +259,10 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': 'id2',
'id': 'id2', 'layer': 'type2',
'layer': 'type2', 'source': 'type2',
'source': 'type2', 'label': 'Blues Cafe, test3, Smithfield'
'label': 'Blues Cafe, test3, Smithfield'
}
} }
}, },
{ {
@ -285,12 +275,10 @@ module.exports.tests.search = function(test, common) {
] ]
}, },
'properties': { 'properties': {
'geocoding': { 'id': '34633854',
'id': '34633854', 'layer': 'venue',
'layer': 'venue', 'source': 'osm',
'source': 'osm', 'label': 'Empire State Building, Manhattan, NY'
'label': 'Empire State Building, Manhattan, NY'
}
} }
} }
] ]

Loading…
Cancel
Save