[GIS] How to add Geoserver WFS to Leaflet JS Application

geoserverleafletpostgiswfs

I have a PostGIS database and have successfully consumed a table into GeoServer and published a WFS. Are there REST endpoints available for these WFS' akin to ESRI's feature services? How are parameters to be constructed?

Best Answer

To learn more about the Rest-Module of geoserver i can recommend you this website: http://geoserver.geo-solutions.it/edu/en/rest/using_rest.html but I guess that you just want to load a WFS-Layer into your Leaflet-map, so you can have a look at this post:

http://blog.georepublic.info/2012/leaflet-example-with-wfs-t/ Here the Requests for the WFS-layer are written from scatch. I have tested it and it works.

Or this Leaflet-Plugin: https://github.com/flatrockgeo/leaflet.wfs-t

If you don't need WFS-T than on of these posts could be enough:

https://stackoverflow.com/questions/25187937/loading-geojson-layers-from-geoserver-to-leaflet-map-based-on-the-current-boundi (answer of user "user3919282")

or this post where it is explained how to enable jsonp in Geoserver: Getting WFS data from Geoserver into leaflet

I have tested this post (Answer from user "geomajor56") GeoServer 2.4.1: How to use JSONP in a WFS request? and made a JSFiddle: http://jsfiddle.net/expedio/8r1ncv6a/