I'm a complete beginner in the world of GIS. And I've been wondering: how do I know where a WMS is, and what layers there are that I can import into my map?
To make it a bit more concrete: I just found the wonderful OpenLayers tutorial here. In this tutorial we import a layer from a WMS by coding:
var vectorLayer = new ol.layer.Tile({
source: new ol.source.TileWMS({
preload: Infinity,
url: 'http://felek.cns.umass.edu:8080/geoserver/wms',
serverType:'geoserver',
params:{ 'LAYERS':"Streams:Developed",
'TILED':true}
})
});
Now this works fine, and surely is done like that in lots of tutorials.
However, what I couldn't find on any tutorial I've seen, is how do we actually know about the data we are importing? The above example assumes that we know that there is a WMS behind the url http://felek.cns.umass.edu:8080/geoserver/wms
, that we are dealing with a GeoServer
and not, for instance, with a MapServer
, and, most amazingly, that we know that there is a layer called Developed
in the Streams
workspace on that server.
Surely there is something that I am missing. Where does one get all that information? I couldn't find it on the wesites of WMS-providers like this one.
Best Answer
So why assume otherwise?
serverType
property is not mandatory. I'd just leave it undefined.For example: In this catalog you found this wms server and followed the link to this XML.
There you'll find a node
Layers
which provides you with a list of available layers and their params.For a little better understanding, maybe it helps if we break down some wms urls:
Lets say, we want to "talk" with the WMS service, so:
To get a better understanding of the structure, we request the capabilities of the service:
You may include the parameter, but this is optional for the capabilities - so the above request is working and we can take a look at the xml to decide our parameters for the "real" request (aka GetMap).
which leaves us with a few additional mandatory parameter.To request a map, we set the operations parameter to:
First: The isn't optional anymore.
A quick look at the xml brings us to:
The bare minimum for a map-request is:
Lets take the Vienna borders and the short-term parking zones within:
Lets start with "all":
As the parameter is mandatory but there's just one, we can leave it empty:
So together:
Or just the south-west, and DL it as a geo-img for offline use: