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" );

  • There is a comma too much after the filter option. – Stefan Jan 24 '19 at 17:53
  • Also I think that color and weight need to be defined in the style option's function. – Stefan Jan 24 '19 at 18:01

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 agree to our terms of service, privacy policy and cookie policy

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