0

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 GeoServerand 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.

3
  • You can see it in the url and those sources are usually marked as wm(t), like in your example, here or here.
    So why assume otherwise?
  • The serverType property is not mandatory. I'd just leave it undefined.
  • You can get a list of available Layers (and a lot other info like CRS/image format(s)/zoomlevel/etc.) from a GetCapabilities request.
    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:

  • Let's assume, we found our geoserver running at
    http://data.wien.gv.at/daten/geo
  • As a gesoserver can provide multiple services (wms/wfs/wcs/..) (like this one), we have to tell it which service we want to use. This is a mandatory parameter
    Lets say, we want to "talk" with the WMS service, so:
    http://data.wien.gv.at/daten/geo?service=wms
  • A WMS provides at least two request operations (GetMap/GetCapabilities), so this is also a mandatory parameter.
    To get a better understanding of the structure, we request the capabilities of the service:
    http://data.wien.gv.at/daten/geo?service=wms&request=GetCapabilities
    You may include the
    version
    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).


To request a map, we set the operations parameter to:

http://data.wien.gv.at/daten/geo?service=wms&request=GetMap
which leaves us with a few additional mandatory parameter.
First: The
version
isn't optional anymore.
A quick look at the xml brings us to:
http://data.wien.gv.at/daten/geo?service=wms&request=GetMap&version=1.3.0

The bare minimum for a map-request is:

  • Obviously we need a CRS:
    &crs=EPSG:4326
  • wms returns an image, so what format
    &format=image/png
  • and which size
    &width=1024&height=720
    do you want it?
  • What do you want to see? (i.e. Layer, can be a comma seperated list)
    Lets take the Vienna borders and the short-term parking zones within:
    &layers=ogdwien:BEZIRKSGRENZEOGD,ogdwien:KURZPARKZONEOGD
  • Which part of it? ("&bbox==minx,miny,maxx,maxy")
    Lets start with "all":
    &bbox=48.10,16.16,48.34,16.59
  • How should it look like (aka "styled")?
    As the parameter is mandatory but there's just one, we can leave it empty:
    &styles=

So together:

http://data.wien.gv.at/daten/geo?service=wms&request=GetMap&version=1.3.0&crs=EPSG:4326&format=image/png&width=1024&height=720&layers=ogdwien:BEZIRKSGRENZEOGD,ogdwien:KURZPARKZONEOGD&bbox=48.10,16.16,48.34,16.59&styles=

Or just the south-west, and DL it as a geo-img for offline use:

http://data.wien.gv.at/daten/geo?service=wms&request=GetMap&version=1.3.0&crs=EPSG:4326&format=image/geotiff&width=1024&height=720&layers=ogdwien:BEZIRKSGRENZEOGD,ogdwien:KURZPARKZONEOGD&bbox=48.10,16.16,48.22,16.35&styles=
3
  • Thanks a lot! I really needed to see how one actually finds a map's description. Awesome! – Michael Langbein Mar 14 '15 at 15:51
  • Absolutely awesome! I didn't expect to receive more than a few pointers in the right direction - and got a whole personal tutorial :) If I could accept more than one answer, I would. Will come back and upvote this in any case. – Michael Langbein Mar 14 '15 at 16:10
  • Well, the concatenation of the map-request is handled by OL anyway. But some general knowledge may be helpful for the "big picture" ;) – ymirsson Mar 14 '15 at 16:20
2

The Web Map Service (WMS) is an OGC standard.

If you are interested in the details you can navigate to the PDF OpenGIS Web Map Service (WMS) Implementation Specification on this page.

I am just posting this for completeness; you actually do not have to look this up, as it covers a lot of information that is irrelevant to you at this point.

What is important to you is that such a WMS has to be composed of at least two request types: GetCapabilities and GetMap. You are interested in the GetCapabilities part, which contains all of the metadata of a service. If you open the URL to the WMS in your browser you will be lead to the capabilities. This will be in XML format and it will provide you with any information you might need, such as the different layers the service contains. It might take some scrolling to find the actual information at first, but once you get used to the XML structure this will be a piece of cake :-)

Should you be working with Firefox you might also want to have a look at the WMS Inspector add-on.

1
  • Wow, great! That helped me a lot indeed. I'll be digging into it straight away! Tanks! (PS: Will upvote the answer once I've gathered 15 pts of reputation :) ) – Michael Langbein Mar 14 '15 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.