diff --git a/helper/geojsonify.js b/helper/geojsonify.js index fc22b06d..ec1e20f6 100644 --- a/helper/geojsonify.js +++ b/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 ) );