jeudi 15 janvier 2015

Setting properties of geoJSON in OpenLayers


I have a map with layers that have similar attributes. I want to add a function that when you select a feature in a layer, it searches for a feature with similar properties in another feature (in this case NAME) and if a similar feature property is found, then the styling of the matching feature is altered.


I have a JSfiddle that tries to achieve this here: http://ift.tt/1CavWTx


The function is called by using the second button. As you can see the get() of features works from the function called by the first button.


Here I mainly have problems with how you can set properties (instead of getting them) in the VectorSource GeoJSON file. I use .attr() but I am not sure if that actually works. Does anyone know how to do this?


Any help would be appreciated!


Cheers,


Tim.





Aucun commentaire:

Enregistrer un commentaire