[gdal-dev] PostGIS with more than one geometry column per table | R-Trees

Even Rouault even.rouault at spatialys.com
Sat Jan 14 04:06:45 PST 2017


On vendredi 13 janvier 2017 16:54:55 CET Alexander.Berdnikow at mettenmeier.de wrote:
> Hi,
> 
> sorry, there is a half copy of this post in the forum already, which was
> not accepted by the maillist.
> 
> I translated a Table (Feature) of a PostGIS Database to a GeoPackage with
> GDAL. The Feature has two Linestring Geometries in the PostGIS DB. One
> geometry with exact positions of the network and one overwiew geometry
> which may have just rough positions. Often the overwiew ist just a copy of
> the exact positions, but sometimes it differs.
> 
> After translation of the feature to GeoPackage everything seems fine, but
> in the GeoPackage I have only one Linestring geometry. It is listed in the
> gpkg_geometry_columns.
> 
> My question is, which of the two geometries was translated to the
> GeoPackage?

The first geometry column reported in the PostGIS layer (as you can see with ogrinfo)

> What happens to the other geometries of the feature in the
> translation process?

Ignored / dropped.

> 
> I've read about the solution of the multiple geometries issue in
> GeoPackage in the GP-specification. Does GDAL support this in the
> translation process (maybe with a special option?)?

Not sure which solution you are talking about.

> 
> ______
> 
> A first solution for us was to use a View Schema, where each feature has
> only one geometry. Now I have two schemas in the PostGIS DB and they were
> both translated. Two questions about it:
> 
> - Is there a command to say which schemas to translate and which not? My
> command is now as follows:
> ogr2ogr -f GPKG data.gpkg PG:"host=localhost user=user dbname=data
> password=pw"
> 
> I found options to select tables, but there are hundreds of tables in the
> schema I am interested in. Maybe there is an easy  possibility to say
> "take only schema x"? Did not found it in the list
> http://www.gdal.org/ogr2ogr.html

You need to read the documentation of the PostGIS driver:
http://gdal.org/drv_pg.html

You can use add " schemas=xxxx" to the connection string.

> 
> - How can I supress the building of r-tree tables? There are virtually
> thousands of them in the created geopackage.

Documentation of the GPKG driver:
http://gdal.org/drv_geopackage.html

-lco SPATIAL_INDEX=NO

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170114/29b7423d/attachment-0001.html>


More information about the gdal-dev mailing list