How can I load a geojson file from geoserver in leafletjs? There are lot of suggestions out there, but none of them work for me.
This is my application: http://185.19.29.22:8080/cresh_map/new1.html
Currently it loads a js file from the server that starts like this:
var boundaries ={ - followed by the geojson file content
To speed things up (and make it work in older browsers) how do I define variable boundaries = { - geojson from geoserver?
All I have so far is (not working):
var owsrootUrl = 'http://185.19.29.22:8080/geoserver/cresh/ows';var defaultParameters = { service : 'WFS', version : '1.0.0', request : 'GetFeature', typeName : 'cresh:datazone_popup', outputFormat : 'json', format_options : 'callback:getJson', SrsName : 'EPSG:4326'};var parameters = L.Util.extend(defaultParameters);var URL = owsrootUrl + L.Util.getParamString(parameters);var boundaries = null;var ajax = $.ajax({ url : URL, dataType : 'json', jsonpCallback : 'getJson', success : function (response) { boundaries = L.geoJson(response, { style: function (feature) { return { stroke: false, fillColor: 'FFFFFF', fillOpacity: 0 }; } }); }});Geoserver is installed on the same server as my webapp and WFS is running.
Any help is much appreciated!!
Ilona
أكثر...
This is my application: http://185.19.29.22:8080/cresh_map/new1.html
Currently it loads a js file from the server that starts like this:
var boundaries ={ - followed by the geojson file content
To speed things up (and make it work in older browsers) how do I define variable boundaries = { - geojson from geoserver?
All I have so far is (not working):
var owsrootUrl = 'http://185.19.29.22:8080/geoserver/cresh/ows';var defaultParameters = { service : 'WFS', version : '1.0.0', request : 'GetFeature', typeName : 'cresh:datazone_popup', outputFormat : 'json', format_options : 'callback:getJson', SrsName : 'EPSG:4326'};var parameters = L.Util.extend(defaultParameters);var URL = owsrootUrl + L.Util.getParamString(parameters);var boundaries = null;var ajax = $.ajax({ url : URL, dataType : 'json', jsonpCallback : 'getJson', success : function (response) { boundaries = L.geoJson(response, { style: function (feature) { return { stroke: false, fillColor: 'FFFFFF', fillOpacity: 0 }; } }); }});Geoserver is installed on the same server as my webapp and WFS is running.
Any help is much appreciated!!
Ilona
أكثر...