angular-leaflet-directive icon indicating copy to clipboard operation
angular-leaflet-directive copied to clipboard

Attach a style to each feature of geojson

Open sayush opened this issue 9 years ago • 3 comments

I've got a geojson file of US states. I want to generate a heatmap like visualization by painting each of these features differently. I've done it before (without angular) by implementing something like this: http://gis.stackexchange.com/questions/75590/setstyle-function-for-geojson-features-leaflet

However, when I try it with angular-leaflet like this,

geojson.style = {
    fillColor: getStyle, // getStyle does not get called. 
    weight: 2,
    opacity: 1,
    color: 'black',
 };

function getStyle(f){
    console.log(f); //f is undefined
}

I'm confused on how to pass the feature to the function. The geojson feature in my case has properties like count which i use to pick appropriate color. Thanks.

sayush avatar Sep 07 '16 15:09 sayush

+1

sudhirbitsgoa avatar Sep 13 '16 18:09 sudhirbitsgoa

I ended up accessing the map object and changing it there. Let me know if y'all find a better alternative.

sayush avatar Sep 13 '16 18:09 sayush

No solution ?

Simon-GHI avatar Mar 05 '18 13:03 Simon-GHI