[gdal-dev] Bogus <gml:Face> interpretation
strk at keybit.net
Sun Jan 30 06:09:12 EST 2011
I'm writing GML output routines for Topologically-defined features
in PostGIS and found what I think is a bug in how ogr interprets
the <gml:Face> tag contents.
Take this topology:
| F1 |
| n3 |
| ,-e2->-+ |
| | | |
| | F2 | |
| | | |
| +-<-e7-' |
| n4 |
It occurs to me that face F1 above is bounded by all edges,
not just the exterior ones, so I'd put _all_ edges inside
one gml:Face tag:
<directedEdge orientation="-" id="e1" />
<directedEdge orientation="-" id="e2" />
<directedEdge id="e3" />
<directedEdge id="e4" />
This is expressed clearly in the OGC 03-105r1 document (GML-3.1.1, 2004)
and 07-036 (GML-3.2.1, 2007)
The non-dangling edges in the boundary of a face comprise one or more
topological rings. Each such ring consists of directedEdges connected
in a cycle, and is oriented with the face on its left.
Now, when encountering such a GML snippet, ogr2ogr (GML driver)
insists in considering all edges as being part of the same ring
thus producing an invalid polygon as a result.
It basically interprets a <gml:Face> tag as if it was a ring, which
I belive is wrong.
Another example of such invalid intepretation follows:
| F1 | F2 |
A surface/polygon formed by the two faces above (F1,F2) should be
<directedFace> <Face id="F1"/> </directedFace>
<directedFace> <Face id="F2"/> </directedFace>
Whereas the resulting feature geometry should be a single-ring polygon:
the topological _union_ of the two faces (I haven't tested this but
I belive GDAL would get this wrong as well).
On the PostGIS side, I've so far implemented the "invalid" representation
for the sake of interoperability with GDAL, but being a new implementation
I'd rather get it right from the start...
Note that using the "invalid" (but GDAL-compatible) representation also
has the negative effect of making it _impossible_ to map PostGIS(ISO)
topologies to GML in a lossless way (PostGIS topology faces would have
no direct corrispondence to <gml:Face> tags).
I hope, with this mail, to get some feedback from the authors of the
GML reading capabilities of GDAL to plan actions towards interoperability
of the two systems and adherence to the standard (if possible).
() Free GIS & Flash consultant/developer
More information about the gdal-dev