[Gdal-dev] SDE Driver Change

Frank Warmerdam warmerdam at pobox.com
Fri Oct 27 10:39:19 EDT 2006


Christian Ratliff wrote:
>   Perhaps you can help me figure out this puzzle. In a multi-polygon,
> from what I can find, the OGRLinearRing::isClockwise() function is the
> way to determine if a ring is a contour (clockwise) or a hole
> (counter-clockwise). When reading GML, MIF, TAB and SHP if isClockwise()
> is true then the ring is a contour, otherwise it is a hole.  However,
> when reading from ARC/SDE the behavior was opposite.
> 
>   I would rather avoid encoding knowledge of the data source in to the
> OGR geometry processor code, up in my application.  Except for that
> option, how is one to determine the implication of isClockwise() or
> perhaps I totally flubbed and missed a 'isHole()' method somewhere?

Christian,

An OGRMultiPolygon consists of a list of set OGRPolygons.

An OGRPolygon consts of an outer ring, and zero or more inner rings.

The outer ring of an OGRPolygon is fetched using OGRPolygon::getExteriorRing()
while interior rings are fetched using OGRPolygon::getInteriorRing().  There
should never be any ambiguity about which ring is an outer ring or an inner
ring.  And it is not based on clockwise or counterclockwise winding order.
And apparent relationship between outer/inner ringedness and winding order
is a coincidental and must not be depended upon.

So if a ring is an interior ring, then it is a hole.  Otherwise it is not.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list