[Gdal-dev] OGR Questions

Frank Warmerdam warmerdam at pobox.com
Sat Dec 13 01:55:35 EST 2003


Curt Mills wrote:
> 1) Can the coordinate system change per layer in a vector file?  If
> not, shouldn't the call to get the spatial reference be based on the
> datasource instead of the layer?

Curt,

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

> 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?

> 3) Is there a standard anywhere for how to specify drawing
> preferences across GIS systems?  I'm talking about things like
> enabling/disabling layers, deciding which field is the label for the
> object, colors, layer stackup, line widths, polygon fill or outline,
> etc.  The sorts of things that might be written to a file that
> accompanies a dataset, or perhaps covers a directory heirarchy of
> GIS files.

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.

> 4) Getting the number of points in a feature:  Is that always an
> "inexpensive" operation?  If it can be "expensive", is there a way
> to gain the entire set of vectors instead that would be faster?  I
> saw nothing in ogr_api.h about it.
> 
> Again, I'm using the C API to OGR.

Getting the number of points in an OGRGeometry is generally cheap.  If the
geometry is a collection,then you would have to dig through the tree to get
the total count, but it is still relatively cheap.

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 Gdal-dev mailing list