Quiero preguntar, es decir, ¿por qué el color del mapa de calor no se muestra en el mapa? y uso de API y GeoJSON, ¿hay algún problema con mi propia codificación? ¿Hay alguna parte de const position = response.features
? Enlace 1 y Enlace 2
El siguiente ejemplo no muestra el color del mapa de calor, pero sale como un cuadro y dice marker
.
useEffect(() => { setIsLoading(true); getLocation(body) .then((response) => { const array = []; response.features.forEach((element) => { array.push({ type: "Feature", properties: element["attributes"], geometry: { type: "Point", coordinates: [ element["geometry"]["x"], element["geometry"]["y"], ], }, }); }); const FeatureCollection = { type: "FeatureCollection", features: array, }; if (geoJsonLayer.current) { geoJsonLayer.current.clearLayers().addData(FeatureCollection); } const position = response.features ? response.features.forEach((element) => { return [element["geometry"]["x"], element["geometry"]["y"]]; }) : []; if (geoJsonLayer.current) { L.heatLayer(position).addTo(FeatureCollection); } setData(FeatureCollection); }) .catch((err) => console.log(err)) .finally(() => setIsLoading(false)); }; fetchData(); }, [bounds, setIsLoading, tokenArcgis]);