Browse Source

refactor for clarity

pull/124/head
Peter Johnson 10 years ago
parent
commit
ee24214aae
  1. 9
      helper/geojsonify.js

9
helper/geojsonify.js

@ -61,9 +61,14 @@ function search( docs, params ){
// convert to geojson
var geojson = GeoJSON.parse( geodata, { Point: ['lat', 'lng'] });
// add bbox
// bounding box calculations
// @note: extent() sometimes throws Errors for unusual data
// eg: https://github.com/pelias/pelias/issues/84
try {
geojson.bbox = extent( geojson ) || undefined;
var bbox = extent( geojson );
if( !!bbox ){
geojson.bbox = bbox;
}
} catch( e ){
console.error( 'bbox error', e.message, e.stack );
console.error( 'geojson', JSON.stringify( geojson, null, 2 ) );

Loading…
Cancel
Save