I am using GetFeatureInfo to create a popup for different layers and features in a map in Leaflet. I have up to 3 layers that can be visible and overlapping at any given time. If I put the option "feature_count=3" in my request to GeoServer it works great with the exception of when I am zoomed out and features are very small. When this happens and only one layer is visible I will often get 3 results in the popup for that layer. It seems that since the location I click on might refer to more than one feature in a layer, it returns three features for that layer. I have different code that inserts only visible layers into the code below.

How do I ensure that when clicking the map, only one feature's info per layer is returned in the popup? I wish the "feature_count" option referred to how many features to return per layer.


Is there an option in GeoServer that I am missing or an option in my code? Do I have to generate a different link like the one above for each layer?

  • Have you tried &maxFeatures=1 parameter?
    – artwork21
    Commented Dec 21, 2016 at 18:31

1 Answer 1


Yes, you have to generate one request per layer with FEATURE_COUNT=1 in each.

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.