Getting attribute table from geoserver layer in Leaflet

Skip to first unread message

dickson mbeya

Jun 14, 2022, 11:01:42 PMJun 14
to Leaflet
 I have been trying to get attribute table of a geoserver layer in leaflet but I haven't been successful. Any one with an idea on how I can go about it. Specifically, I want the attribute table of the layer to popup when someone clicks on a polygon that is displayed in leaflet map.


Edwin Corrigan

Jun 19, 2022, 8:58:44 AMJun 19

Couple of things that might help:
- You can make a WFS getFeature request to Geoserver which can return a geojson format -
- L.geoJson can be used to render the returned geojson on the map -
onEachFeature can be passed as an option to L.geoJson, here is an example -
- You can access the properties object on each feature in your geoJson with something like (I added a console.log from the above example):
- Adjust your html in layer.bindPopup, you can add third party UI libraries here too
- If you'd like the popup to appear on events such as click, dblclick, mouseover etc, you can replace the bindpopup function and render an L.popup inside the event handler function. Something like - layer.on(<event>, handler function), 

Best Regards, 


Edwin Corrigan 


Tel: (353) 87 7552 666


You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages