[Gdal-dev] RDBMSes with multiple geometry columns

Frank Warmerdam warmerdam at pobox.com
Thu Mar 8 19:06:38 EST 2007


Mateusz has been looking into bug 1476 related to postgis tables with
multiple geometry columns:


Mateusz raised the question of whether we should refactor the OGR API
to support multiple geometry columns.  As usual, I am very leery of
API breakage, and responded as follows.  I thought the issues are broad
enough that I should bring them to the attention of the group for additional


In the short to medium term we can't practically reengineer OGR to support
multiple geometry columns properly.  What we might consider are special ways
of selecting the geometry column to use.

I can quickly imagine 3 scenarios that might apply.

1) We actually offer distinct appearing layers for each geometry column.  So
if the table roads has two geometry columns, one called centerline, and one
called boundaries we might show the application a layer called
roads_centerline, and roads_boundaries.

2) We could provide a mechanism in the datasource connection string where
a particular geometry column could be selected for a given table.  For
instance I think we already support listing the tables to be represented
as layers in the PG driver connection string.  We could allow adding a
geometry column in brackets after the table name as a way of selecting the
geometry column to use.  If unspecified, the first geometry column would
be used.

3) We could extend the OGR API with a way of listing the geometry columns
available for a layer, and a method for selecting a particular one.  Note,
we already have the informative GetGeometryColumn() method which for some
RDBMS providers returns the name of the currently used geometry column.

I'm inclined to pursue option (1) in the postgis driver for the time being
as it requires no changes to public apis and applications.  I think option
(3) should be a longer term goal.

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