|
|
@ -61,9 +61,14 @@ function search( docs, params ){ |
|
|
|
// convert to geojson
|
|
|
|
// convert to geojson
|
|
|
|
var geojson = GeoJSON.parse( geodata, { Point: ['lat', 'lng'] }); |
|
|
|
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 { |
|
|
|
try { |
|
|
|
geojson.bbox = extent( geojson ) || undefined; |
|
|
|
var bbox = extent( geojson ); |
|
|
|
|
|
|
|
if( !!bbox ){ |
|
|
|
|
|
|
|
geojson.bbox = bbox; |
|
|
|
|
|
|
|
} |
|
|
|
} catch( e ){ |
|
|
|
} catch( e ){ |
|
|
|
console.error( 'bbox error', e.message, e.stack ); |
|
|
|
console.error( 'bbox error', e.message, e.stack ); |
|
|
|
console.error( 'geojson', JSON.stringify( geojson, null, 2 ) ); |
|
|
|
console.error( 'geojson', JSON.stringify( geojson, null, 2 ) ); |
|
|
|