Wednesday, 3 October 2018

geoserver - WFS and WMS query SRS parameter and BBOX usage



WMS and WFS queries needs SRS and BBOX parameters.


http://example.com/geoserver/wfs?
service=WFS&
version=2.0.0&
request=GetFeature&
typeNames=namespace:featuretype&
srsName=CRS&
bbox=a1,b1,a2,b2&


For example I have GeoServer to publish WFS. My data SRS is EPSG:4326 and my map SRS is EPSG:3857. So I send a WFS query.


http://example.com/geoserver/wfs?
service=WFS&
version=2.0.0&
request=GetFeature&
typeNames=namespace:featuretype&
srsName=EPSG:3857&
bbox=978393.9621,2680799.4560,-430493.3433,3326539.4710&


Does GeoServer or ArcGIS server give an error? Because my data has EPSG:4326 . Or does GeoServer convert these coordinates internally and find data and send me as EPSG:3857



Answer



WMS and WFS have different behavior.


In WMS the SRS and BBOX parameters are mandatory and the SRS defines both the output projection, and the BBOX has to be expressed in the SRS coordinates.


In WFS instead they are both optional, and not linked to each other. srsName defines the desired output projection, so it will cause reprojection, while the BBOX is, for compatibility reasons, best expressed using the 5 parameters approach, stating clearly the CRS of the bbox.


So a fully complaint request for a demo layer in EPSG:4326, to be reprojected in 3857, would be:


http://demo.geo-solutions.it/geoserver/tiger/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=tiger:tiger_roads&srsName=EPSG:3857&bbox=40.7,-74,40.8,-73,urn:ogc:def:crs:EPSG:4326&maxFeatures=1


(note how the bbox is expressed in lat/lon too, in order to be fully compliant with WFS 1.1 specification expected axis order)


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...