leaflet-geoserver-request icon indicating copy to clipboard operation
leaflet-geoserver-request copied to clipboard

Unable to add more that two WFS layers

Open dameattrio opened this issue 1 year ago • 1 comments

I saw another similar issue had been closed a couple years ago (#11), but I'm facing the same problem. Was there ever any resolution? I'm hosting postGIS, GeoServer and Leaflet via nginx all on docker. I've got multiple layers in Geoserver and whenever I do a L.Geoserver.wfs() request more than twice, I get the same error in console. I'm attempting to call several different layers, no two layers are the same. I'll have two working and introduce a third, and the second one stops working, etc.

wfs-related snippet, can provide more

var countyBoundary = L.Geoserver.wfs('https://example.com/geoserver/ows?service=WFS&', {
	layers: "ccps:countyBoundary",
	style: {
		color: "black",
		fillOpacity: 0,
		opacity: 0.75,
		dashArray: (10, 10),
	},
}).addTo(map);

var magisterialDistricts = L.Geoserver.wfs('https://example.com/geoserver/ows?service=WFS&', {
	layers: "ccps:magisterialDistrict",
	style: {
		color: "green",
		opacity: 0.75,
		dashArray: (10, 10),
	},
	onEachFeature: function (feature, layer) {
		layer.bindPopup(feature.properties.magdistnam);
	},
}).addTo(map);

var elementaryBoundary = L.Geoserver.wfs('https://example.com/geoserver/ows?service=WFS&', {
	layers: "ccps:elementaryBoundary",
	style: {
		color: "blue",
		opacity: 0.75,
		dashArray: (10, 10),
	},
	onEachFeature: function (feature, layer) {
		layer.bindPopup(feature.properties.schoolname);
	},
}).addTo(map);

console error: parsererror Error: getJson was not called Uncaught ReferenceError: getJson is not defined Uncaught TypeError: that._map is undefined

What other info would be helpful?

dameattrio avatar Jun 06 '24 13:06 dameattrio