Browse Source

converted to reduce

pull/1002/head
Stephen Hess 7 years ago
parent
commit
314e7eb450
  1. 10
      helper/geojsonify.js

10
helper/geojsonify.js

@ -105,8 +105,7 @@ function addBBoxPerFeature(geojson) {
* @returns {Array} * @returns {Array}
*/ */
function extractExtentPoints(geodata) { function extractExtentPoints(geodata) {
const extentPoints = []; return geodata.reduce((extentPoints, place) => {
geodata.forEach(function (place) {
if (place.bounding_box) { if (place.bounding_box) {
extentPoints.push({ extentPoints.push({
lng: place.bounding_box.min_lon, lng: place.bounding_box.min_lon,
@ -116,16 +115,19 @@ function extractExtentPoints(geodata) {
lng: place.bounding_box.max_lon, lng: place.bounding_box.max_lon,
lat: place.bounding_box.max_lat lat: place.bounding_box.max_lat
}); });
} }
else { else {
extentPoints.push({ extentPoints.push({
lng: place.lng, lng: place.lng,
lat: place.lat lat: place.lat
}); });
} }
}); return extentPoints;
}, []);
return extentPoints;
} }
/** /**

Loading…
Cancel
Save