[Gdal-dev] OGR and multiple geometries per feature type
Frank Warmerdam
warmerdam at pobox.com
Sun Feb 4 12:26:25 EST 2007
Andrea Aime wrote:
> Hi,
> does OGR support features with multiple geometries?
> From the API it seems it does not, but I may be overlooking something.
>
> When I connect ogrinfo to a Postgis table that happens
> to have 4 geometry columns, each registered in the
> geometry_columns table, I get the following:
Andrea,
The OGR code does not support having multiple geometries for a feature
(except containing in a geometry collection of course). In the postgis
driver it scans the geometry_columns table for spatial table names, and
then for each lookups up the geometry column from geometry_columns. So
in this case, it finds the table name 4 times, creates a layer for each,
but always gets the first geometry column each time it rescans for the
associated geometry.
I would appreciate your filing a bug report on this issue. One simple
step would be for us to avoid duplicate compies of a layer though a
better solution might be to establish distinctly named layers for each
possible selection of geometry column.
For your dataset that might look like layers:
major_roads
major_roads_gen_1
major_roads_gen_2
major_roads_gen_3
It will likely be at least a month before something will be done about this
issue, so you will likely need some sorts of work around in the meantime.
If you are trying to translate data to another format from this table, you
could use specific sql statements.
eg.
ogr2ogr out.shp PG:... \
-sql 'select state, gen_1, interstate, ushighway, statehighway, othername,
fid from major_roads'
Good luck,
--
---------------------------------------+--------------------------------------
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