0

Here's my code:

var eurojson = L.geoJSON(
eurojson,{
  onEachFeature: onEachFeature,
  style: EU_color
});

var econjson = eurojson;
econjson.setStyle(Econ);

When I initialize econjson variable, I would like the onEachFeature property to be null, or turned off (I still don't have the vocabulary down yet). But I still need it for the eurojson variable.

1

I'd simply construct a new L.GeoJSON with different options. You can simply leave out the onEachFeature part for the econjson:

var eurojson = L.geoJSON(data,{
    onEachFeature: onEachFeature,
    style: EU_color
})

var econjson = L.geoJSON(data,{
    style: Econ
})

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.