[gdal-dev] Bogus <gml:Face> interpretation

strk strk at keybit.net
Sun Jan 30 06:09:12 EST 2011


Hello,
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:

 n1
  +-----e1-->-----.
  |               |
  |      F1       |
  |           n3  |
  |   ,-e2->-+    | 
  |   |      |    |
  |   |  F2  |    |
  |   |      |    |
  |   +-<-e7-'    |
  | n4            |
  |               |
  `---<-e2--------+
                   n2

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:

 <Face id="F1">
  <directedEdge orientation="-" id="e1" />
  <directedEdge orientation="-" id="e2" />
  <directedEdge id="e3" />
  <directedEdge id="e4" />
 </Face>

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
represented as:

 <TopoSurface id="P1">
   <directedFace> <Face id="F1"/> </directedFace>
   <directedFace> <Face id="F2"/> </directedFace>
 </TopoSurface>

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

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the gdal-dev mailing list