[gdal-dev] GPKG: CREATE TABLE AS not working as expected
Even Rouault
even.rouault at spatialys.com
Thu Dec 28 09:41:04 PST 2017
On jeudi 28 décembre 2017 17:40:18 CET Tobias Wendorff wrote:
> Hi there!
>
> I'm trying to do this on latest ogr2ogr build:
> ogrinfo -al -dialect sqlite -sql "CREATE TABLE sorted AS SELECT * FROM
> mytable ORDER BY ST_GeoHash(ST_Transform(ST_Envelope(geom), 4326), 10)"
> test.gpkg
>
> The command runs without a problem, but the final table doesn't contain
> any content in geometry column... Even a slimmed down example with
> "CREATE TABLE test AS SELECT * FROM mytable;" doesn't work as expected.
>
> Can someone give me a tip on how to get CREATE TABLE AS up and running?
CREATE TABLE will bypass most driver-level logic that is needed for a spatial table to be
properly recognized as such. You could fix that by manually registering the table in
gpkg_contents and gpkg_geometry_columns table, but the most simple way of
accomplishing what you want to do is:
ogr2ogr -update test.gpkg test.gpkg -sql "SELECT ..." -nln sorted
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/20171228/08fe19a4/attachment.html>
More information about the gdal-dev
mailing list