[gdal-dev] Export to Geopackage
Even Rouault
even.rouault at spatialys.com
Thu Mar 14 08:16:25 PDT 2019
On jeudi 14 mars 2019 11:11:42 CET Randal Hale wrote:
> If I export a postgis table to geopackage:
>
> ogr2ogr -f GPKG export.gpkg PG:"host=gis1 user=rjhale dbname=dbname
> password=pass" -nln "addresspoints" -sql "select id, geom, addresses"
>
> I check the geopackage:
>
> rjhale at gis7:~/temp$ ogrinfo -so -al TCStransport.gpkg
>
> INFO: Open of `TCStransport.gpkg'
>
> using driver `GPKG' successful.
>
> Layer name: addresspoints
>
> *Geometry: Unknown (any)*
>
> Feature Count: 23735
>
> Any idea on what I'm doing wrong - the unknown geometry seems to be
> causing an issue in another process. If I export without the SQL
> statement everything is fine.
Randy,
You aren't doing something wrong. This is just that the PostGIS driver cannot
retrieve the layer geometry type if using a SQL statement (could perhaps be
improved in simple situations where selecting from a single table without join
or transformation on the geometry). You can force the output layer geometry
type by adding -nlt POINT|LINESTRING|POLYGON|etc.
See doc of -nlt in https://gdal.org/ogr2ogr.html
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list