mardi 14 janvier 2020

Leaflet fill geojson polygon png pattern

I'm using this plugin https://github.com/lwsu/leaflet-polygon-fillPattern to fill my geojson polygons with .png pattern.

It works great when I use the basic syntax, i.e :

L.polygon(poly1, {fill:'url(image.gif)'}).addTo(map);

But I'd like to grab value from geojson properties to change the fill pattern.

so far, i'm using this syntax where pattern value is stored in

feature.properties.PolygonFill

I tied this syntax :

L.polygon(poly1, {
fill:'url('+feature.properties.PolygonFill+')'
}).addTo(map);

But returned value is null and no image is displayed.

Any idea of what is wrong ?

Aucun commentaire:

Enregistrer un commentaire