1

I am trying to convert from PostGIS to FileGDB using GDAL (ogr2ogr). One of my fields is an integer field and declared in PostGIS as an int4. However when I do a standard ogr2ogr export looking at the FileGDB the field comes out as a Long Integer. So I am trying to override the defaults using COLUMN_TYPES but I cannot seem to find a list of correct values to use.

ogr2ogr -f OpenFileGDB  Output.gdb PG:"dbname=x user=x password=x host=x port=x" -sql "SELECT * from table" -lco COLUMN_TYPES=featurecode=Int16

I have tried Short Integer, smallint, and lots of different things including OFSTInt16

Does anyone know where a definitive list of field types is?

1
  • 2
    "Long Integer" in FGDB is int4 (long long/int8 won't be supported until Pro 3.1/ArcGIS 11.1)
    – Vince
    Feb 1 at 19:00

1 Answer 1

3

There is this test in the GDAL autotest suite https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_fgdb.py#L819

# Test all data types
...
    feat.SetField("esriFieldTypeSmallInteger", 12)
    feat.SetField("esriFieldTypeInteger", 3456)
    feat.SetField("esriFieldTypeSingle", 78.9)
    feat.SetField("esriFieldTypeDouble", 1.23)
    feat.SetField("esriFieldTypeDate", "2012/12/31 12:34:56")
    feat.SetField("esriFieldTypeString", "astr")
    feat.SetField(
        "esriFieldTypeGlobalID", "{12345678-9ABC-DEF0-1234-567890ABCDEF}"
    )  # This is ignored and value is generated by FileGDB SDK itself
    feat.SetField("esriFieldTypeGUID", "{12345678-9abc-DEF0-1234-567890ABCDEF}")
3
  • thanks @user30184. Looking at that I should be then trying to use the words SmallInteger how I get an error "Ignoring COLUMN_TYPES=featurecode=SmallInteger : SmallInteger not recognized"
    – tjmgis
    Feb 1 at 16:14
  • Did you try esriFieldTypeSmallInteger?
    – user30184
    Feb 1 at 16:34
  • 1
    No I didnt, but i should have done because that has worked, thank you so much, been going around in circles for hours.
    – tjmgis
    Feb 1 at 16:43

Your Answer

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

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