[OSGeo-Discuss] multipatch shapefile FIRST_RING structure

Frank Warmerdam warmerdam at pobox.com
Mon Jan 26 10:34:11 PST 2009

Rushforth, Peter wrote:
  > The shapefile spec for multipatch shapefiles says this:
> "When the individual types of rings in a collection of rings representing a
> polygonal patch with holes is unknown, the sequence must start with First
> Ring, followed by a number of Rings" (p 21).
> Figure 3 shows a "First Ring" as an inner ring with an exterior ring as a
> "Ring".
> Does this mean a receiving application must be prepared to figure out the (3
> dimensional) topology of the rings it reads from a shapefile? Why? When
> would this ever be the case?


An application that wants to process multi-patch shapefiles, including those
using the FirstRing/Ring part types and that cares about nesting of rings
must be prepared to do a geometric analysis to determine which are inner
and outer.

 > I mean an application that doesn't know which
 > is the exterior ring from the interior rings of an internal data structure
 > has no business writing them out and thus make them someone else's problem,
 > in my view.

Everyone is entitled to an opinion...

I would note that multi-part shapefiles are (in my experience) very rare.

A more serious issue is that there are lots of applications that have
written out polygon shapefiles without following the specification properly
resulting in improper ring orientation and/or ordering meaning that an
application that wants to play it safe needs to do detailed geometric
analysis on polygon shapefiles too.

In the past shapelib and OGR were quite careless about how they wrote
out shapefiles, and part of my penance is that they now have to do geometric
analysis when reading which can be quite expensive.

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    | Geospatial Programmer for Rent

More information about the Discuss mailing list