Re: Using field name as variable in a "dialect sqlite" query
> I have this kind of CSV
> Is it possible to use ogrinfo and a "dialect sqlite" query in this way,
> set the EPSG by reading the value from the `epsg` field?
> ogrinfo -dialect sqlite -sql "select ST_GeomFromText('POINT(' || x || ' '
> y || ')',epsg) from source" source.csv source
> If yes, how?
> Thank you
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 wonder if anybody has tried to make SQL injection through the name of the
geometry column :)
ogrinfo -dialect sqlite -sql "select ST_GeomFromText('POINT('|| x || ' ' ||
y || ')',CAST(epsg AS integer)) from coords" coords.csv
INFO: Open of `coords.csv'
using driver `CSV' successful.