I have a county polygon GeoJSON file shown as 4 theme layers, The attributes are the same but the symbology is different. I have a regions file, each region is composed of several counties. I have this as a black outline, so you can see what counties are in what region. So the regions is on top of the turned on themes. What I want to do is get the region to pass the click event to the turned on theme. I'm using radio buttons for the themes so only one can be on at a time. I've tried various variations of this code without luck. The region layer's on-click passes the click X,Y and fires a function that should check the theme layer and use the X,Y for a click.

if (map.hasLayer(theme1)) {
     theme1.fireEvent('click', {latlng:[y,x]});
if (map.hasLayer(theme2)) {

Error message is Can't read fire of undefined.

1 Answer 1


Since my region layer didn't need an on.click I removed it from my forEachFeature and in the style I just added interactive: false, and it worked.

function style5(feature) {      //Regions
    return {
        interactive: false,
        fillOpacity: 0,
        weight: 3,
        opacity: 1,
        color: 'Black' 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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