| Timoney Group WMS Presentation at May '09 GISCO Mtg |
| Introduction | ||||
With desktop GIS being dominant in many shops, WMS services too often go under-utilized as the first inclination of many analysts is to download data and create layers from local copies of this information. This creates all manner of clutter (stacks of CDs/DVDs doing double duty as coffee mug coasters, not to mention data currency and versioning headaches). In many cases, a quick visual identification of the "lay of the land" is all the user really needs--not an intensive drill-down into attributes. Since WMS services return only an image (JPEG, PNG, etc.) with they are an efficient, effective solution for this common use-case. Consumed via simple URL strings, WMS services can be harnessed by a wide variety users, not just programmers/developers/code jockey gurus. This presentation will highlight WMS services offered by the USGS and BLM (with bonus coverage of the WMS services launched this month by DRCOG) and illustrate how they can be easily consumed using free web-based viewers such as Google Earth and OpenLayers. | ||||
| Figuring Out What's On Offer: The GetCapabilities Request | ||||
Figuring out what a service is offering in terms of layers, projections, scale-dependencies, you make a GetCapabilities request via a URL. Check out the GetCapabilities document from the USGS TerraServer service: http://terraserver-usa.com/ogccapabilities.ashx?version=1.1.1&request=getcapabilities&service=wms You may or may not get some inscrutable text in your browser (depends on browser type) with a lot of EPSG codes, however if you use your browser's View Source capability, you'll see that there is an underlying XML document with lots of metadata. For instance, looking <Layer> tags, you will want to see the names of the layers that are available. | ||||
| Testing a WMS Through The Browser | ||||
So using the information from the GetCapabilties request, we can put together a URL to make valid GetMap requests that will return an image representation of spatial data: Sample GetMap (Topo) from USGS Service Sample GetMap (DOQ) from USGS Service Sample GetMap (Urban Area) from USGS Service If you take a look at the URL in your browser, you will see parameters such as these-- http://terraservice.net/ogcmap.ashx? This is the 'root' URL of the service. VERSION=1.1.1 This is the version of WMS service. &REQUEST=GetMap We are requesting an map image. &SRS=EPSG:4326 The projection we are requesting using the EPSG code. &WIDTH=512 Width of image we want. &HEIGHT=512 Height of image we want. &LAYERS=DRG What layers from the service we want--can request multiple layers. &STYLES= Some services offer multiple styling options for layers. &TRANSPARENT=FALSE Will image be transparent in areas of no data (gif and png only). &FORMAT=image/jpeg Image type. &BBOX=-105.5,39.5,-104.5,40.5 Bounding box coordinates in MinX, MinY, MaxX, MaxY format. | ||||
| BLM GeoCommunicator WMS--A Plethora of Land Information | ||||
In the last couple of years, the BLM has made a number of web services available through its GeoCommunicator.gov site. However, it takes some digging to figure out how to get at their stuff via WMS. But it can be done, with a couple of tricks. Check out the laundry list of services here. Here is a GetCapabilities request for their PLSS service. You may need to save it as a text file and view it in a text editor a la WordPad. In the samples below, you will notice that an extra parameter has been added: REASPECT=false. Some services try to reconcile your bounding box coordinates with the height and width of the image requested--but many WMS viewers don't overlay the 'corrected' image that is returned properly. Setting REASPECT to false means that if the height/width ratio is inappropriate to the X/Y ratio of the bounding box coordinates, the user will have to deal with the resulting distorted image on their own. Land Grid sample Oil & Gas Lease sample National Forest sample Viewing WMS Layers in Google Earth |
It might have occurred to you that hand-entering URLs in a browser may not be a particularly efficient way to view WMS services. | You would be correct. In Google Earth you can bring in WMS in the following manner: "Add-->Image Overlay-->(Refresh tab)-->WMS Parameters (button)" --You can call up a service by choosing Add and entering the 'root' URL of a service e.g. http://www.geocommunicator.gov:80/wmsconnector/com.esri.wms.Esrimap/BLM_MAP_SURFACE_MGT_AGY? It will issue a GetCapabilities request and parse the response for you, giving you an interactive list of layers to choose from. Since you still won't know scale dependencies, etc. it is a matter of trial and error to figure out exactly how stuff will display. After you choose a layer or two, (remember the layers are rendered in the order they are requested...). Hit 'OK'. Since this a BLM layer, in the 'Link' field of the Properties window, add "&REASPECT=false" to the end of the URL string to get a properly referenced image. You can fiddle with other parameters to get the display to refresh more quickly, etc. Rocking WMS Layers in OpenLayers
| OpenLayers is an interactive "slippy map" API that is both completely free and easy to use. Even if you don't program, you can throw together an interactive map in a short time that will stun and amaze your colleagues. Open Layers Example #1 This example pulls layers from the BLM, USGS, and the recently launched DRCOG WMS services. Be sure to check out the source code to see how easy it is to set up. Licensing Cost of OpenLayers: $0.00 Cost of Accessing BLM, USGS, and DRCOG Layers: $0.00 # of CDs/DVDs on Your Desk: 0 Data Management Headaches & Wondering About the Currency of the Local Version of the Data You Are Looking At: 0 BONUS: Commercial Basemaps in OpenLayers + DRCOG WMS Layers You can stream tiles from commercial providers such as Google, Yahoo, and Microsoft into OpenLayers (they have varying commercial license agreements, so if you are using it behind a firewall, make sure to read the legalese). The catch is that the commercial providers use a somewhat funky spherical mercator projection (EPSG:3785) for their tiles that kinda-sorta-but not really lines up with lat/long projections at local scales (and definitely does not line up a regional/national scales). Since this projection is relatively new, most WMS providers don't offer their layers in this projection. But our forward-thinking Denver Regional Council of Governments (DRCOG), using the open-source GeoServer, is offering their layers in this projection. Open Layers Example #2 This map shows a handful of their WMS layers and commercial services working hand-in-hand. Note that in the code for the DRCOG layers we add parameters for this new projection ('srs') and a 'reproject' flag. |