More

Can't enable Jsonp in Geoserver 2.7.0 and then publishing my WFS request in Leaflet


I'm working on localhost:8080 and want to get WFS data in a Leaflet map. So, I've read in some posts here that I first I have to enable Jsonp in my web.xml file in Geoserver. So I put

 ENABLE_JSONP true

But I can't see that Jsonp is allowed with a getCapabilities :

  text/xml; subtype=gml/3.2 GML2 KML SHAPE-ZIP application/gml+xml; version=3.2 application/json application/vnd.google-earth.kml xml application/vnd.google-earth.kml+xml application/x-gpkg csv geopackage geopkg gml3 gml32 gpkg json text/xml; subtype=gml/2.1.2 text/xml; subtype=gml/3.1.1

Then, I tried to load my WFS data into a GeoJson layer in leaflet with this code :

     Test WFS      

And firefox's console return

SyntaxError: missing ; before statement ows:1:7

Is someone knows why it doesn't work ?


Have you restartet Tomcat / Geoserver after editing the web.xml?

Your capabilities should show this entry:

text/javascript

Your javascript-code seems ok. --> slightly adapted with an other Geoserver/Layer here: http://jsfiddle.net/expedio/u1oskkxy/


Watch the video: Publishing WMS and WFS with GeoServer and Leaflet (October 2021).