[gdal-dev] ogr2ogr preserve fid behavior

Alexandre Gacon alexandre.gacon at gmail.com
Fri Oct 14 02:13:05 PDT 2022


Hi

I managed to get the expected result by removing the options -preserve_fid
and --config PGSQL_OGR_FID id and by using an existing table set correctly
with the right column as primary key.

Alexandre

Le jeu. 13 oct. 2022 à 10:28, Rahkonen Jukka <
jukka.rahkonen at maanmittauslaitos.fi> a écrit :

> Hi,
>
>
>
> I think that shapefile does not have a proper fid to preserve. I am
> remembering that I have used the -sql option sometimes for controlling the
> FID, something like -sql “SELECT geometry, id AS FID, attribute_1,
> attribute_2 … FROM …”
>
>
>
> -Jukka Rahkonen-
>
>
>
> *Lähettäjä:* gdal-dev <gdal-dev-bounces at lists.osgeo.org> *Puolesta *Alexandre
> Gacon
> *Lähetetty:* torstai 13. lokakuuta 2022 11.13
> *Vastaanottaja:* gdal-dev <gdal-dev at lists.osgeo.org>
> *Aihe:* [gdal-dev] ogr2ogr preserve fid behavior
>
>
>
> Hello,
>
>
>
> I am trying to upload some data from SHP to Postgres. I would like to use
> a given column of my SHP as primary key in replacement of the id generated
> by ogr2ogr but I don't manage to have the result I want.
>
>
>
> I used the options -preserve_fid and --config PGSQL_OGR_FID id which gave
> the following output: I have a column "id" as primary key but it does not
> contain the value of my SHP but an auto increment value.
>
>
>
> The SHP is not used directly but I do some computations and name changes
> using a sql statement with the sqlite dialect.
>
>
>
> Any idea on how I could have directly my "id" column as primary key with
> the values of my input ?
>
>
> --
>
> Alexandre Gacon
>


-- 
Alexandre Gacon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221014/e7e3e840/attachment.htm>


More information about the gdal-dev mailing list