У меня возникла ошибка, указывающая, что data.forEach не является функцией. Код:Для каждого цикла ---> Для цикла
function getProperGeojsonFormat(data) {
isoGeojson = {"type": "FeatureCollection", "features": []};
console.log("After getProperGeojsonFormat function")
console.log(data)
console.log("")
data.forEach(function(element, index) {
isoGeojson.features[index] = {};
isoGeojson.features[index].type = 'Feature';
isoGeojson.features[index].properties = element.properties;
isoGeojson.features[index].geometry = {};
isoGeojson.features[index].geometry.coordinates = [];
isoGeojson.features[index].geometry.type = 'MultiPolygon';
element.geometry.geometries.forEach(function(el) {
isoGeojson.features[index].geometry.coordinates.push(el.coordinates);
});
});
$rootScope.$broadcast('isochrones', {isoGeom: isoGeojson});
}
ошибки я получаю:
Когда я утешаю данные журнала:
это зависит от того, является ли массив данных или нет. –
a [mcve] было бы здорово! –
Они уже помогли вам – zerkms