Be a Client of an OGC WMS Web Service

As I mentioned in last month’s issue, the Open Geospatial Consortium’s standards - Web Map Service and Web Feature Service - represent a new paradigm for geospatial data sharing. We’ll take a look at using a WMS service in ArcGIS and on the web with MapServer.

To recap a bit from last month, the key difference between a WMS server and a WFS server is the WMS serves an image only – a image representation of geospatial information. A WFS server sends the actual geospatial information itself in GML (geography markup language), an OGC standard XML format, and relies on the client to render the XML as graphics. WFS requires a considerable deal more bandwidth than WMS and it needs a smart client to interpret and render the XML, but it allows for things like data downloads and editing. As ArcCatalog can’t operate as a WFS client, we’ll be looking exclusively at WMS.

First, let’s take a look at being a client to a WMS service. (Note – you need ArcGIS Desktop 9.1 for this.) Open up ArcCatalog. In the Catalog Tree, open up the GIS Servers header.

This node allows you to become a client to ArcGIS, ArcIMS, or OGC WMS servers. You probably have a link already in place to the Geography Network. Play with that later. For now, click on Add WMS Server.

We’re going to add the TerraServer web service. TerraServer is a joint USGS-Microsoft public web service that includes satellite imagery and scanned DRQ maps. Double-click “Add WMS Server”. In the URL box, type in this exactly:

http://terraserver.microsoft.com/ogccapabilities.ashx?
http://terraserver-usa.com/ogccapabilities.ashx?

Hit the Get Layers button. You should see some fairly uninteresting information. Hit Ok.

This is where things head south in a hurry. ArcGIS is an extremely bad WMS client. I cannot emphasize enough just how badly it sucks in this manner. If you preview your new connection, you’ll likely get some errors, so don’t bother with that. Let’s wait for ArcMap for that. Open up ArcMap, open your new server connection in ArcCatalog (there should be a ‘+’ beside it), and drag it over to ArcMap. Now you’ll get lovely errors. Sigh. In the Map Scale box (the one that says something like 1:52,244,778), type 1:10000.

What you’re playing with is GIS data on a server on the other side of the country. You’ve got USGS DOQ, DRG, and Urban Area data you could (theoretically, if ArcMap didn’t suck so bad in this regard) overlay with local data or data from other web services and do productive things.

MapServer, the open source web mapping software we’ve talked about a few times before, is a much better client for WMS services, consuming them easily and reprojecting them to whatever you’re using. The following code in a map configuration file is all you need to add TerraServer WMS data to your site:

LAYER
NAME terraserver_sat
TYPE raster
STATUS OFF
CONNECTIONTYPE WMS
CONNECTION “http://terraserver-usa.com/ogccapabilities.ashx?"
MINSCALE 1000
METADATA
“wms_server_version” “1.1.1”
“wms_srs” “EPSG:4326”
“wms_format” “image/jpeg”
“wms_styles” “GEOGrid_Cyan”
“wms_name” “UrbanArea”
END
END

I’ve added this functionality to Address Information Center on a new Imagery tab.

You can use the data like any other local raster dataset, overlaying our information, using transparency, etc. Some WMS services also have the ability to do an identify to return information from vector data.

I hope this at least gives you a taste of WMS and how it can be used to share data. While SDE still makes great sense as a multi-user editing environment, increasingly other technologies are becoming available that make more sense for general data sharing across organizations and over the Internet.

*If you want to try out a better WMS desktop client, check out uDig. It’s free.