Ticket #138 (defect)
Opened 1 year ago
Last modified 1 year ago
Support for Nested Layers and Relaxed Parsing
Status: closed (fixed)
| Reported by: | ww | Assigned to: | seang |
|---|---|---|---|
| Priority: | major | Milestone: | OWSLib 0.3 |
| Component: | OWSLib | Version: | |
| Keywords: | contents | Cc: | |
As discussed today in IRC on #zco on irc.freenode.net,
16:29 < ww> considering, for example,
http://atlas.gc.ca/cgi-bin/atlaswms_en?VERSION=1.1.0&SERVICE=WMS&request=GetCapabilities
16:30 < ww> owslib breaks on this because layers are nested in a way that breaks the
assumptions documented on line 178 of owslib/wms.py
16:30 < ww> viz:
16:30 < ww> # contents: our assumption is that services use a top-level layer
16:30 < ww> # as a metadata organizer, nothing more.
16:30 < ww> best way to fix?
16:31 < ww> should wms.capabilities necessarily be a simple list? or rather a tree
structure?
16:32 < ww> (n.b. owslib also breaks for similar reasons on the metacarta wms server that
provides vmap0 as used in many openlayers examples)
The first problem is indeed a result of atlas.gc.ca using Layers in order to work around WMS defects -- they use a Layer without a Name as a container to describe a dataset. In this way they can serve multiple datasets out of one WMS URL, but this is perhaps a bit of an abuse of the spec.
The second problem, with Metacarta's VMAP0 is that they don't fill in attributes of contact person and abstract. Perhaps negligent on their part, but I suppose the maxim, "be conservative in what you send and liberal in what you receive" applies here.
The attached patch fixes both problems, relaxing the parsing with respect to abstract and contact, and implementing recursively nested layers. It amounts to a rewrite of ContentMetadata and a small amount of glue in ServiceMetadata to support this new implementation. In particular, ServiceMetadata? implements backwards compatibility code to flatten the layer tree into the contents attribute which should behave as usual. The actual tree is available in a new attribute called layers.
Attachments
Change History
12/03/07 12:58:47: Modified by ww
- attachment owslib-nested-layers.diff added.
12/03/07 13:06:03: Modified by seang
- keywords set to contents.
- status changed from new to assigned.
- component changed from Data Stores and Sources to OWSLib.
12/04/07 10:05:27: Modified by ww
- attachment owslib-whitespace-srs.diff added.
12/04/07 10:06:22: Modified by ww
- attachment owslib-nested-layers-whitespace-combined.diff added.
nested layers and whitespace SRS in one patch
12/04/07 10:09:45: Modified by ww
The two patches just added further relax parsing. Some WMS implementations found in the wild will include multiple SRS values as a whitespace delimited list inside a single <SRS> tag rather than using multiple SRS tags. This is probably invalid behaviour, but is unfortunately relatively common. The owslib-whitespace-srs.diff patch applies on top of the first, nested-layers, patch and allows such tags. The owslib-nested-layers-whitespace-combined.diff patch is simply both changes in a single patch for easy applicatin to an unmodified SVN trunk.
12/09/07 14:12:04: Modified by seang
- status changed from assigned to closed.
- resolution set to fixed.
Combined patch committed in r981.

patch (on top of nested-layers) for whitespace separated SRS