data.forEachが関数ではないというエラーがあります。コードは次のとおりです。各ループについて---> Forループ
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});
}
私は取得していますエラーは次のとおりです。
私はデータログコンソールとき:アレイ上ではなく、オブジェクトの
データが配列かどうかによって異なります。 –
[mcve]は素晴らしいでしょう! –
彼らはすでにあなたを助けました – zerkms