0

I need to create heatmap based on length property from a LineString GeoJSON file.

I have tried to use Leaflet.heat plug-in, but this tool accepts points not lines.

here is my code:

$.getJSON("data/lines.geojson",function(data){
   var locations = data.features.map(function(rat) {
    var location = [rat.geometry.coordinates[0], rat.geometry.coordinates[0]];
    location.push(rat.properties.Distance);
    return location;
  });

  var heat = L.heatLayer(locations, { radius: 35 });
  map.addLayer(heat); 
});

Am i need to create an array that contains [startY, startX, endY, endX, length]?

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.