[Gdal-dev] OGR Questions

Curt Mills, WE7U archer at eskimo.com
Sat Dec 13 03:12:38 EST 2003

On Sat, 13 Dec 2003, Frank Warmerdam wrote:

> In theory different layers in a datasource can have different coordinate
> systems, though this is uncommon.  It does happen though.

I'm going to ignore it then for our application.  If it ever happens,
they can convert the dataset to something reasonable and try reading
it in again.  I'm just snagging the spatial info from layer 0 right

> > 2) Shapefile "hole" polygons:  Are there other OGR formats that do
> > something similar?  Should I check whether the datasource is a
> > shapefile and implement "hole" polygons only for them?
> I'm not sure what a hole polygon is.  A shapefile polygon file may
> have Polygon and MultiPolygon geometries.  Till just recently multipolygons
> were just returned as polygons, but Radim recently fixed this.
> What do you mean?

In Shapefiles, there are "fill" polygons, and there are "hold"
polygons in those filled polygons.  The direction of the vertices
as you walk around the polygon tells you which it is, hole or fill.
I've seen some implementations of Shapefiles where they ignore this.
You end up with problems like this:  Puget Sound (Seattle Area) has
a water polygon.  On it is an Island (Whidbey Island), that has a
lake with an island on it.  Without holes, the Island itself might
not appear, same for the lake on the island, and the island in that.

I've seen the same problem with a Shapefile of San Fransisco area.

I was wondering if some of the other formats that OGR supports might
have a similar thing in them.

> There are many standards.  Within the OGR API the preferred approach
> to this is the OGR Feature Style Specification:
>    http://gdal.velocet.ca/~warmerda/projects/opengis/ogr_feature_style_008.html
> Basically this is intended to provide a mechanism for different underlying
> formats to indicate their rendering information.  It is at least partially
> implemented for the DGN and Mapinfo drivers.  The only applications that I
> am aware of taking advantage of it are OpenEV and MapServer.

I'll take a closer look at that.  We have an AWK-like setup for
Shapefiles right now, and with the GDAL/OGR integration, it may be
time to look into a more general method.

One more question:  If a system already uses libproj, libshape, and
libgeotiff, might it cause problems at link time if the gdal library
is linked at the end, and some of the three mentioned libraries are
older?  I know that gdal uses all three of these, but I don't know if
it's linking to them at that stage.  I'm still getting runtime
segfaults with OGR, both with Shapefiles and with SDTS so far, when
coordinate translation code is invoked.  I'm just about to test with
the different link order (-lgdal first) to see if that solves the

Curt, WE7U.				archer at eskimo.com
  Lotto:  A tax on people who are bad at math. - unknown
Windows:  Microsoft's tax on computer illiterates. - WE7U.
The world DOES revolve around me:  I picked the coordinate system!"

More information about the Gdal-dev mailing list