#5741 closed enhancement (wontfix)
FileGDB coded value domains
Reported by: | Mike Taves | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
A problem with the current [Open]FileGDB drivers is that layers that use coded value domains show different attributes to that shown in ArcGIS.
Esri's description of coded value domains are described in XML Schema of the Geodatabase. A range domain type is also described in the whitepaper. Note that this is different than #4455, which describes a spatial domain.
So for example, I have a FileGDB layer that uses a field named DIP with type Short, and a coded value domain DipCategories with the following:
Code | Description |
1 | Low |
0 | Unknown |
3 | Shallow |
2 | Moderate |
4 | Steep |
ArcGIS will show the Description only, and GDAL will show the Code only. Also, interestingly, exporting the FDB from ArcGIS to a Shapefile (using Esri tools) will only show the codes. Ideally, a read-only [Open]FileGDB GDAL driver would identify the columns that use coded value domains, change their schema to match the description, and use the description in place of the code. Essentially, the result would be the same when viewing the attributes in ArcGIS.
From what I see, the coded domain descriptions are in a00000004.gdbtable, and this table can be accessed using the OpenFileGDB driver. So where name='DipCategories', the definition is (xmlprettyprint):
<?xml version="1.0"?> <GPCodedValueDomain2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:typens="http://www.esri.com/schemas/ArcGIS/10.0" xsi:type="typens:GPCodedValueDomain2"> <DomainName>DipCategories</DomainName> <FieldType>esriFieldTypeSmallInteger</FieldType> <MergePolicy>esriMPTDefaultValue</MergePolicy> <SplitPolicy>esriSPTDefaultValue</SplitPolicy> <Description>Valid Dip Categories</Description> <Owner/> <CodedValues xsi:type="typens:ArrayOfCodedValue"> <CodedValue xsi:type="typens:CodedValue"> <Name>Low</Name> <Code xsi:type="xs:short">1</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>Unknown</Name> <Code xsi:type="xs:short">0</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>Shallow</Name> <Code xsi:type="xs:short">3</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>Moderate</Name> <Code xsi:type="xs:short">2</Code> </CodedValue> <CodedValue xsi:type="typens:CodedValue"> <Name>Steep</Name> <Code xsi:type="xs:short">4</Code> </CodedValue> </CodedValues> </GPCodedValueDomain2>
Attachments (1)
Change History (6)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
I've attached a composite screenshot from various dialogs from QGIS, using the OpenFileGDB driver, and ArcGIS 10.0. The are viewing the same data source, but are presented differently.
Esri mix either the code or description in various contexts, as shown above. I don't think translations for multilingual countries is covered by Esri, so I would't worry about that.
I think at bare minimum, the coded value domains from a00000004.gdbtable
or GDB_Items
should be exposed as really simple tables. (For what it's worth, the Esri tool for this is Domain To Table (Data Management), and this recipe shows how to export all attribute domains into tables).
This way, a user can at least access the information from the coded value domain, for example with SQL:
SELECT DipCategories.description AS DIP FROM my_layer LEFT JOIN DipCategories ON DipCategories.code=my_layer.DIP
comment:3 by , 9 years ago
I'd like to support mwtoews proposal to expose a coded value domain as a simple lookup table.
Be aware that ArcGIS 10 help [1] says that there are two domain types (range domain and coded domain) and that "A coded value domain can apply to any type of attribute" (short/long integers, float, double, text and date).
[1] http://resources.arcgis.com/en/help/main/10.2/index.html#//001s00000001000000
comment:4 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
comment:5 by , 3 years ago
Support for field domain added in https://github.com/OSGeo/gdal/pull/3638
I would say that if I had to select either the code or the description I would take the codes just like GDAL and ESRI when it saves data into shapefiles. Description are good for humans but code values often make sense in queries "select * where steepness_class >= 2". Also for in multilingual countries and in international usage there can be a need to use several human readable descriptions.
Rather than using descriptions instead of codes I could think about two alternatives: