[gdal-dev] Export / import from PostGIS to GRASS and primary keys

Juan Pedro Pérez Alcántara jp.perez.alcantara at gmail.com
Thu Oct 21 05:00:43 PDT 2021


Hi there,

I have some questions about the role of primary keys when importing /
exporting between PostGIS and GRASS. I've been making some tests regarding
this process and what follows are my impressions, so they may be wrong in
some points.

I fully understand that, given the disparity of data models,
simplifications needs to be taken regarding the very complex primary key
arrangements (multi column keys, for example) a Relational Database can do,
and that going through the GDAL pipeline with an integer autonumber ogc_fid
key is the sensible way to go, this is something that can be easily managed.

However, my workflow implies quite a lot of PostGIS ingested data that goes
to GRASS to perform topology cleaning and some other operations and back to
PostGIS. In this process, I've notice the following:

- GDAL ignores the primary key of the database, substituting it with an
ogc_fid, when importing into GRASS;

- when going back to PostGIS, another key comes from GRASS. I'm aware of
the FID option to rename the key.

My problem with this is that I lose in the process the original PostGIS
table PK. I'm workarounding this by making a physical copy of the PK into
another column, so when data is back, I can link original / GRASS processed
data.

Then, my question is: is there a way to keep the PK field at PostGIS into
the GDAL pipeline as a normal column, so I don't have to duplicate the
original PK as I'm doing right now?

Thank you so much, best regards,

---

Juan Pedro Pérez Alcántara

jp.perez.alcantara at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211021/51e7e408/attachment.html>


More information about the gdal-dev mailing list