[gdal-dev] Appending a column on shapefile import to postgis via
ogr2ogr
Frank Warmerdam
warmerdam at pobox.com
Fri May 23 15:00:37 EDT 2008
On 5/23/08, Aaron Racicot <aaronr at z-pulley.com> wrote:
...
> Is something like that possible?
>
> Basically in the end I would like something like:
> ogr2ogr -update -append -f PostgreSQL PG:'host=localhost user=racicot
> dbname=xxx' -sql "select 'aaronr' as author, * from test" test.shp -nln
> user_shapes
>
> My hope was that I could add the author field to the -sql statement and have
> it populate the 'author' column in my postgis table. If something like this
> from the command line would work then I could just swap in an arbitrary
> username for 'aaronr' in the above example on the data import via my script
> and have a unique way to keep track of the data once it is imported.
Aaron,
I'm afraid this isn't possible because the SQL statement is being
evaluated by the OGR SQL engine in this case, and the OGR SQL
engine is quite limited. It lacks, for instance, the ability add
columns in the select from fixed values.
Sorry!
The OGR SQL document should give some ideas of the limitations
of the OGR SQL engine.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list