3

We have several file gdb's and would like to convert these to Postgres / PostGIS. We've used ogr2ogr to transfer these files; however, some of the fields are stored as coded domains and the fields are not decoded in the transfer. Coded domains are stored in a separate table.

For example, a column design quality could belong to the general domain quality. Quality could then be coded as '1=low, 2=medium, 3=high'. This is to enforce that only certain values are used, for instance in a survey. Ogr2ogr reads the values 1, 2, and 3, but not the accompanying text.

Would anybody know how to include these domains in the transfer from gdb to Postgres / PostGIS?

We could convert to file gdb's to an ArcSDE database if this is easier; however shapefiles are not preferred due to column truncation.

This question was posted earlier here on StackOverflow.

Michael
  • 138
  • 7
  • If you have SDE just copy/paste using ArcCatalog. Copies the data, domains and subtypes. – Michael Stimson Jul 14 '14 at 02:14
  • This PostgreSQL/PostGIS answer to an Oracle question may help: http://gis.stackexchange.com/questions/10397/is-it-possible-to-create-domains-for-an-oracle-non-sde-database/10487#10487 – PolyGeo Jul 14 '14 at 03:26
  • Database domains aren't necessarily recognized by the consuming program. The issue here is that descriptions are text and the values are (usually) numeric. That would involve a fundamental change of data type for the field. You can export your domains to table, join and then export to lock in the values but then you end up with two fields, one numeric and the other text, describing the same information... to easy to get out-of-step, best to delete the numeric field after exporting if you want the text. – Michael Stimson Jul 14 '14 at 03:33
  • Coded domains are the equivalent of constraints in a db? – John Powell Jul 12 '14 at 13:22
  • Coded domains are stored in a separate table. For example, a column design quality could belong to the general domain quality. Quality could then be coded as '1=low, 2=medium, 3=high'. This is to enforce that only certain values are used, for instance in a survey. Ogr2ogr reads the values 1, 2 and 3 and not the accompanying text. – Michael Jul 14 '14 at 02:08
  • I usually export the featureclasses to shapefile in ArcGIS. That way the domains are converted to the actual values. Afyer That I export to postGIS – Devdatta Tengshe Jul 14 '14 at 10:27

1 Answers1

3

Well, before you convert the database, you could run the Domain to Table geoprocessing tool http://resources.arcgis.com/en/help/main/10.1/index.html#/Domain_To_Table/001700000022000000/ which should convert a domain to a stand-alone table that you could put in the database. Then, you should be able to just convert the database, including stand-alone tables in the database. Finally, at the end (or before you do the database conversion for that matter), you could do a join between the Feature Class attribute tables and the domain table, or you could even use a join to calculate the domain description value into the relevant feature classes as a new field. Anyway, I hope that gives you some ideas, and let me know if it doesn't make sense and I'll try and clarify.

John
  • 3,853
  • 12
  • 17