6

In ogr2ogr I can specify the name of FID column using the option -lco FID={columnname} when importing a spatial data in PostGIS database. I am using shp2pgsql in case of shapefile and cannot find a way to specify FID column (searched here).

Is there an easy way to achieve this or do I have to do some workaround?

Note: A ticket has been created on this issue.

1 Answer 1

5

I suspect we don't support it, however you could try with the -m switch where what follows the -m is the filename consisting of old name and new name. It might not work though since gid is an autogenerated field name.

If it doesn't feel free to put in a ticket in our ticket tracker http://trac.osgeo.org/postgis/newticket

. i think it's a fairly easy change for us to make and can probably do it in upcoming PostGIS 2.2

2
  • 1
    As I suspect, currently the name is always set to gid. If another column already exists with this name, that column is renamed to __gid. Am I correct? This will help me for now. I am also checking the -m option you suggested. I am creating a ticket anyway.
    – Mohayemin
    Commented Feb 10, 2015 at 4:59
  • Yes as I recall, I think that is what happens.
    – Regina Obe
    Commented Feb 10, 2015 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.