[gdal-dev] ogr2ogr -sql and -nln
Mike
mswope at gmail.com
Wed Mar 8 05:09:44 PST 2017
I'm getting this
Warning 1: layer names ignored in combination with -sql.
However, I need to use the -sql query as I'm adding fields and populating
them as I go.
The source dataset cannot be edited.
I'm trying to combine several datasets into various tables in PostGIS,
where there's a name difference between the source layer and the PostGIS
table name.
my command is in this format.
ogr2ogr -f PostgreSQL -a_srs "EPSG:4326" PG:dbname=SomeDB <insert some
options> Sourcedata -nlt POLYGON -skipfailures -explodecollections -sql
"SELECT *,'VALUE1' AS valuefield, 1 as anotherfield FROM <layer> WHERE
OGR_GEOMETRY='POLYGON' OR OGR_GEOMETRY='MULTIPOLYGON'" <layer>
I wish to not put it in a table named <layer> in my PostGIS/SomeDB, but
rather <layer>+somesuffix
This is easy with -nln, but when I added the -sql, I get the warning above,
and it seems to drop it in just <layer> and not <layer>+somesuffix.
How can I accomplish what I want?
This is ultimately run on many datasets, so it will be appending to
existing tables (or create them if they didnt exist yet).
-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170308/0d3e6631/attachment.html>
More information about the gdal-dev
mailing list