[gdal-dev] OGR SQL CAST geometry example
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Fri May 31 00:40:34 PDT 2024
Hi,
As far I know the the Spatialite functions https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html by design work row by row and one input row returns one output row. Therefore DissolvePoints creates one row with a multipoint geometry, not several rows like ST_Dump does. You can discuss about that in the spatialite-users forum https://groups.google.com/g/spatialite-users.
It is possible to extract the points from linestrings with SpatiaLite SQL by using NumPoints and then PointN in a loop, but such SQL is not possible to execute with ogrinfo/ogr2ogr. It is possible to do amazing things with ogr2ogr and SQL but it does make it the right tool for demanding ETL processes. Typically people turn to use Python at that point.
If you have a real need to extract points from a linestring by using only GDAL command line utilities, it should be possible to do in two steps. Create an interim file by using the Spatialite function DissolvePoints, and then run ogr2ogr with the -explodecollections option.
-Jukka Rahkonen-
-----Alkuperäinen viesti-----
Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Dan Jacobson via gdal-dev
Lähetetty: perjantai 31. toukokuuta 2024 8.36
Vastaanottaja: Daniel Baston <dbaston at gmail.com>
Kopio: gdal-dev at lists.osgeo.org
Aihe: Re: [gdal-dev] OGR SQL CAST geometry example
Alas, even for MULTIPOINT, as there are no facilities for extracting from aggregates, not even ST_Dump, in the end all one can do is $ ogrinfo 0.lines.kml -al | perl -nwle \
'if(/LINESTRING.*\((.*)\)/){print for split /,/, $1}'
-100.790056666679 36.3802233333333 1000
-100.790080000013 36.38531 1000
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list