[GIS] GeoServer GeoJSON WMS layer request in Mapbox

geoservermapbox-gl-jswms

I'm creating a Mapbox GL JS web map which pulls GeoJSON layers from GeoServer. I've used the documentation to find my problem lies in the 'GetFeatureInfo' get request URL which follows the following format (though in one line of course):

http://localhost:8080/geoserver/wms?
INFO_FORMAT=application/json&
REQUEST=GetFeatureInfo&
EXCEPTIONS=application/vnd.ogc.se_xml&
SERVICE=WMS&
VERSION=1.1.1&
WIDTH=970&
HEIGHT=485&
X=486&
Y=165&
BBOX=-180,-90,180,90&
LAYERS=CampusMap:dwt-campus-json&
QUERY_LAYERS=CampusMap:dwt-campus-json&
TYPENAME=CampusMap:dwt-campus-json&

My problem is that this link does not work, and when I run it in a browser I receive various WMS error files that are not very helpful. I really just want to be able to get this link to work so I can have this building footprints file load on my basemap and be query-able for future use.

Best Answer

You are probably confusing the WMS GetFeatureInfo operation and a WFS GetFeature operation.

Your error is that the request is missing an SRS parameter, (e.g. SRS=epsg:4326&). You also have a typename parameter (which is not a GetFeatureInfo parameter), this isn't causing the problem, but it adds no meaning to the request and will be ignored.

Related Question