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. 12
      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');
}
var geocoding = {};
var output = {};
addMetaData(place, geocoding);
addDetails(details, place, geocoding);
addLabel(place, geocoding);
addMetaData(place, output);
addDetails(details, place, output);
addLabel(place, output);
var output = {};
output.geocoding = geocoding;
// map center_point for GeoJSON to work properly
// these should not show up in the final feature properties
output.lat = parseFloat(place.center_point.lat);

12
test/unit/helper/geojsonify.js

@ -140,7 +140,6 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': 'id1',
'layer': 'type1',
'source': 'type1',
@ -159,7 +158,6 @@ module.exports.tests.search = function(test, common) {
'street': 'Liverpool Road',
'postalcode': 'N1 0RW'
}
}
},
{
'type': 'Feature',
@ -171,7 +169,6 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': 'id2',
'layer': 'type2',
'source': 'type2',
@ -186,7 +183,6 @@ module.exports.tests.search = function(test, common) {
'locality': 'test2',
'neighbourhood': 'test3'
}
}
},
{
'type': 'Feature',
@ -198,7 +194,6 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': '34633854',
'layer': 'venue',
'source': 'osm',
@ -215,7 +210,6 @@ module.exports.tests.search = function(test, common) {
'category': ['tourism', 'transport']
}
}
}
]
};
@ -249,13 +243,11 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': 'id1',
'layer': 'type1',
'source': 'type1',
'label': '\'Round Midnight Jazz and Blues Bar, test3, Angel'
}
}
},
{
'type': 'Feature',
@ -267,13 +259,11 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': 'id2',
'layer': 'type2',
'source': 'type2',
'label': 'Blues Cafe, test3, Smithfield'
}
}
},
{
'type': 'Feature',
@ -285,14 +275,12 @@ module.exports.tests.search = function(test, common) {
]
},
'properties': {
'geocoding': {
'id': '34633854',
'layer': 'venue',
'source': 'osm',
'label': 'Empire State Building, Manhattan, NY'
}
}
}
]
};

Loading…
Cancel
Save