Re: [gdal-dev] GPKG: CREATE TABLE AS not working as expected

2017-12-28 Thread Tobias Wendorff
Am Do, 28.12.2017, 23:50 schrieb jratike80: > I would try with SQL that does not select the FID instead of "select *". > See preserve_fid in http://www.gdal.org/ogr2ogr.html. Not guaranteed > to work. The other way did it: adding "-unsetFid" seems to loosen up the order to FID and creates a new on

Re: [gdal-dev] GPKG: CREATE TABLE AS not working as expected

2017-12-28 Thread jratike80
Tobias Wendorff wrote > 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: > ogri

Re: [gdal-dev] GPKG: CREATE TABLE AS not working as expected

2017-12-28 Thread Tobias Wendorff
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 ta

Re: [gdal-dev] GPKG: CREATE TABLE AS not working as expected

2017-12-28 Thread Even Rouault
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 comma

[gdal-dev] GPKG: CREATE TABLE AS not working as expected

2017-12-28 Thread Tobias Wendorff
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