Working with WMS

From Wildsong
Jump to navigationJump to search

Resources

This GeoServer page has a good description of WMS services. https://docs.geoserver.org/stable/en/user/services/wms/reference.html

The (somewhat dry technical) standard is at OGC is here: https://www.ogc.org/standards/wms and the reference/demo server is here: https://www.ogc.org/standards/wms/quickstart

Find out what a WMS service can do

Start with the basic URL, this is the OGC reference server. This will just return a (relatively useless) informational message.

http://metaspatial.net/cgi-bin/ogc-wms.xml

Then add the GetCapabilities request (note these are not supposed to be case sensitive, so REQUEST=request)

http://metaspatial.net/cgi-bin/ogc-wms.xml?request=GetCapabilities&service=wms

This will return an extensive XML file with the capabilities of the server listed.

Find out about a layer

Plucking the name of a layer from a GetCapabilities request, I can ask for more information on that layer. If I omit the version I get an error.

This does not return information on layer 1 alas. It just gives me the top level info again. Oh well I press on. Fix this later

https://gis.blm.gov/arcgis/rest/services/vegetation/BLM_Nat_AIM_Terrestrial/MapServer/WMSServer?SERVICE=WMS&LAYERS=1&REQUEST=DescribeLayer&VERSION=1.3.0

Get information from a queryable layer

https://gis.blm.gov/arcgis/rest/services/vegetation/BLM_Nat_AIM_Terrestrial/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&LAYERS=1&STYLES=&SRS=EPSG:4326&BBOX=-124.1,46.3,-123.35,-45.77&WIDTH=1&HEIGHT=1&QUERY_LAYERS=1&INFO_FORMAT=HTML&X=-123.817605&Y=46.181317

Setting the SRS

In my case, the default for this server is to return its images in "EPSG=4326" which is unprojected WGS84. If I want Oregon state system "EPSG=2992" I can add the SRS like this:

https://gis.blm.gov/arcgis/rest/services/vegetation/BLM_Nat_AIM_Terrestrial/MapServer/WMSServer?SERVICE=WMS&SRS=EPSG:2992