[gdal-dev] How to append data into an existing database table

Even Rouault even.rouault at mines-paris.org
Mon Jan 9 17:23:51 EST 2012


Le lundi 09 janvier 2012 22:47:21, Jeremy Palmer a écrit :
> Hi All,
> 
> I've got an existing spatial table in PostgreSQL with has an existing
> primary key (non-serial) and shape column:
> 
> CREATE TABLE test_1
> (
>   id integer NOT NULL,
>   appellation TEXT,
>   affected_surveys TEXT,
>   parcel_intent TEXT NOT NULL,
>   topology_type VARCHAR(100) NOT NULL,
>   statutory_actions TEXT,
>   land_district VARCHAR(100) NOT NULL,
>   titles TEXT,
>   survey_area numeric(20,4),
>   calc_area numeric(20,4) NOT NULL,
>   shape geometry,
>   PRIMARY KEY (id)
> );
> 
> I'm trying to append data from a CSV file into a pg database but I'm having
> problems:
> 
> ogr2ogr -append -f PostgreSQL "PG:host=xxxx dbname=xxxx" test1.vrt -nln
> test_1

Try adding the -preserve_fid option of ogr2ogr.


More information about the gdal-dev mailing list