[gdal-dev] Using field name as variable in a "dialect sqlite" query

aborruso aborruso at gmail.com
Thu Nov 23 08:43:34 PST 2017


Hi Jukka,


jratike80 wrote
> You can have only one SRID on a layer so you must either split your data
> by
> the epsg field or transform each record to same SRID. Otherwise your
> request
> was almost complete.

I know, but my problem was the source!


jratike80 wrote
> ogrinfo -dialect sqlite -sql "select ST_GeomFromText('POINT('|| x || ' '
> ||
> y || ')',CAST(epsg AS integer)) from coords" coords.csv

And thank you to your example I have found the solution that was right for
me:

ogrinfo -dialect sqlite -sql "select ST_TRANSFORM(ST_GeomFromText('POINT('||
x || ' ' || y || ')',CAST(epsg AS integer)),4326) from coords" coords.csv 

It gives me 

OGRFeature(SELECT):0
  POINT (15.0 36.1447180988163)

OGRFeature(SELECT):1
  POINT (9.0 36.1447180988163)

Than I have unified all, without splitting my source file (as you have
written I have trasformed each record to same SRID).

You and ogr are great :)




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list