[gdal-dev] GPKG: CREATE TABLE AS not working as expected
Tobias Wendorff
tobias.wendorff at tu-dortmund.de
Thu Dec 28 09:53:11 PST 2017
Thanks for your answer.
Am Do, 28.12.2017, 18:41 schrieb Even Rouault:
>
> 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,
Ah okay. I already thought it wouldn't be as easy as PostGIS ;)
> but the most simple way of accomplishing what you want to do is:
> ogr2ogr -update test.gpkg test.gpkg -sql "SELECT ..." -nln sorted
I just tried it, but the target table has the same order as the
original table:
ogr2ogr -update test.gpkg test.gpkg -sql "SELECT * FROM mytable ORDER BY
ST_GeoHash(ST_Transform(ST_Envelope(geom), 4326), 10)" -nln sorted
This gives me the correct sorting:
ogrinfo -ro test.gpkg -sql "SELECT * FROM mytable ORDER BY
ST_GeoHash(ST_Transform(ST_Envelope(geom), 4326), 10)"
More information about the gdal-dev
mailing list