Browse Source

Merge pull request #47 from pelias/bbox

Bbox
pull/49/head
Harish Krishna 10 years ago
parent
commit
52d4f7dd2a
  1. 7
      helper/geojsonify.js
  2. 5
      package.json
  3. 1
      test/unit/helper/geojsonify.js

7
helper/geojsonify.js

@ -1,5 +1,6 @@
var GeoJSON = require('geojson'),
extent = require('geojson-extent'),
outputGenerator = require('./outputGenerator');
function search( docs ){
@ -54,8 +55,12 @@ function search( docs ){
});
// convert to geojson
return GeoJSON.parse( geodata, { Point: ['lat', 'lng'] } );
var geojson = GeoJSON.parse( geodata, { Point: ['lat', 'lng'] });
// add bbox
geojson.bbox = extent( geojson ) || undefined;
return geojson;
}
module.exports.search = search;

5
package.json

@ -32,12 +32,13 @@
"elasticsearch": ">=1.2.1"
},
"dependencies": {
"async": "^0.9.0",
"express": "^4.8.8",
"geojson": "^0.2.0",
"geojson-extent": "^0.3.1",
"geopipes-elasticsearch-backend": "0.0.8",
"pelias-esclient": "0.0.25",
"toobusy": "^0.2.4",
"async": "^0.9.0"
"toobusy": "^0.2.4"
},
"devDependencies": {
"ciao": "^0.3.4",

1
test/unit/helper/geojsonify.js

@ -101,6 +101,7 @@ module.exports.tests.search = function(test, common) {
var expected = {
"type": "FeatureCollection",
"bbox": [ -0.1069716, 51.517806, -0.101795, 51.5337144 ],
"features": [
{
"type": "Feature",

Loading…
Cancel
Save