1

I have problems with the code, I do not know where to place the part with the popup. This does not work if I want to use the data attribute in the popup window:

var okruh1= L.geoJSON(trate, {
    color: "#3399FF",
    weight: 5 ,
    filter: function(feature, layer) {   
         return (feature.properties.OBJECTID == "1" );
    },
});  

okruh1.bindPopup(layer.properties.OBJECTID);
  • There is a comma too much after the filter option. – Stefan Jan 24 at 17:53
  • Also I think that color and weight need to be defined in the style option's function. – Stefan Jan 24 at 18:01
0

If you want to refer to the layer in bindPopup, you need to pass a function, e.g.

okruh1.bindPopup(function(layer) { 
    return layer.feature.properties.OBJECTID //returns property of the feature rather than the layer
} ); 

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.