0

I followed this methode https://geomappando.com/2016/11/08/come-realizzare-una-heatmap-con-leafletjs/ to get a heatmap from my GeoJSON file. But, I got it without having the value field included.

Here's my Geojson:

var lyrmesures = {
"type": "FeatureCollection",
"name": "mesures_test",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": 1, "_uid_": 1, "id_mesure": 17, "cm": 11627, "gisement": "EL HALASSA", "niveau": "Couche 3", "element1": 5.42, "element2": null, "element3": 6.558, "element4": null, "element5": 5.427, "element6": 5, "puissance": 1.9, "longitude": null, "latitude": null }, "geometry": { "type": "Point", "coordinates": [ -6.888298798254256, 32.639886473063939 ] } } ]}

Here's my code :

            geoJson2heat = function(geojson) {
            return geojson.features.map(function(feature) {
            return {lat:parseFloat(feature.geometry.coordinates[1]), 
                    lng:parseFloat(feature.geometry.coordinates[0]), 
                    value:parseFloat(feature.properties.element6)};
            });
            }

            var mesures = geoJson2heat(lyrmesures, 1);

            var myconf= {
                radius: 20,
                maxOpacity: 0.6,
                scaleRadius: false,
            };

            var heatmapLayer = new HeatmapOverlay(myconf);
            heatmapLayer.setData({max:1, data:mesures});
            mymap.addLayer(heatmapLayer);

Here bellow my result :

enter image description here

  • What do you mean by "without having the value field included"? – TomazicM Jun 4 at 5:33
  • I wonder how the GeoJSON looks like, and what is the element6 property. – IvanSanchez Jun 4 at 5:59
  • I updated my post and added how my GeoJSON looks like. "element6" is a propertie which I would like to add as VALUE to my Heatmap – Sefiane Jun 4 at 12:13
  • Sorry, but it's not clear what's not working since there is some heat map displayed in your result. – TomazicM Jun 4 at 12:18
  • I think that the Heatmap is considering only X and Y. but the Value part is not working – Sefiane Jun 4 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.