[Gdal-dev] Set attribute fields with constants from command line in ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Sun Mar 5 19:51:51 EST 2006


rob at dataflowdesign.com wrote:
> I am using ogr to load SDTS files into Postgresql with postgis. Is
> there a way that I can set a field to a constant value in all rows
> inserted during a single ogr2ogr execution?
> 
> For example, my output RIVERS table contains a field called
> UNIQUE_LOAD_ID (as well as geometry and other attributes).
> I want to be able to set UNIQUE_LOAD_ID = some constant defined on
> the command line for all river features loaded from the SDTS
> file. This could also be a date/timestamp, username, file name, etc.

Rob,

I cannot think of any way to accomplish this with ogr2ogr except for
using a temporary table, and some SQL to copy it into the main table
with the extra value.

But you could do it directly with a special program, or python/perl/etc
script that uses OGR.

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    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list