: Daniel Baston
Kopio: gdal-dev@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(/LINES
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.79005679 36.38022 1000
-100.79008013 36.38531 1
If a single MULTIPOINT record is OK, then you can do
ogrinfo test.shp -q -dialect SQLITE -sql 'SELECT
ST_DissolvePoints(GEOMETRY) FROM test'
Dan
On Thu, May 30, 2024 at 8:49 PM Dan Jacobson via gdal-dev
wrote:
>
> $ ogrinfo 0.lines.kml -q -dialect SQLITE -sql \
> 'SELECT ST_PointN(GEOMETRY, ge
According to http://www3.sqlite.org/series.html, generate_series() is
only built in the sqlite3 command line utility, not in the library
itself. That said, with some work, the source at
https://www.sqlite.org/src/file/ext/misc/series.c could potentially be
embedded into libgdal
Le 31/05/2024
$ ogrinfo 0.lines.kml -q -dialect SQLITE -sql \
'SELECT ST_PointN(GEOMETRY, generate_series(1, ST_NPoints(GEOMETRY))) FROM "0"'
ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(
no such function: generate_series
___
gdal-dev mailing list
gdal-dev@lists.
Ah, I misunderstood and thought you wanted to extract points from
linestrings.
Given
$ cat test.csv
id,my_wkt
1,"POINT Z (1 2 3)"
you can do:
$ ogrinfo test.csv -sql "select id, cast(my_wkt as geometry(pointz,
4326)) from test"
INFO: Open of `test.csv'
using driver `CSV' successful.
> "ER" == Even Rouault writes:
ER> you can't do operations on geometries with OGR SQL...
OK, I'll try it. Thanks.
The page should still have an example of actual use of
Casting ... POINT[Z], LINESTRING[Z]
Without examples people will try things like POINTZ, "POINTS[Z]"
Dan,
you can't do operations on geometries with OGR SQL, but selecting it.
You'd typically need to use the ST_PointN() from Spatialite with the
SQLite dialect
Even
Le 31/05/2024 à 00:32, Dan Jacobson via gdal-dev a écrit :
Hi. I will add an example to
https://gdal.org/user/ogr_sql_dialect.h
Hi. I will add an example to
https://gdal.org/user/ogr_sql_dialect.html#changing-the-type-of-the-fields
showing users how to e.g., CAST LINESTRING Z to POINTS Z, e.g.,
to extract the points from:
$ ogrinfo 0.lines.kml -q -sql 'SELECT "_ogr_geometry_" FROM "0"'
Layer name: 0
OGRFeature(0):1
LINEST