Hello,
I am having trouble when creating a feature class with subtypes and/or coded
domains with the FileGDB or OpenFileGDB drivers, specifically when using the
"XML_DEFINITION" or "DOCUMENTATION" layer creation option. I am simply creating
a dataset and calling on CreateLayer:
lyr = ds.CreateLayer("TESTPOINT_2", geom_type=ogr.wkbPoint,
options=["XML_DEFINITION/DOCUMENTATION=%s" % xmlstr])
ERROR 1: Failed at creating table for \TESTPOINT_2 (General function failure.)
xmlstr is read from a file containing the XML. The XML is based on
FC_PCS_Point.xml found in the ESRI FileGDB API resources (in the XMLsamples
folder) with added domain information.
My question is where and how to to structure the domain and subtype XML
tag/information when using an XML string as part of the XML_DEFINITION or
DOCUMENTATION layer creation options? The GDAL documentation specifically
mentions that for the xml string that the " root node of such a XML definition
must be a <esri:DataElement>". Where are the <Domain> and <Subtype> elements to
be placed? Is the subtype and domain information only referenced in the Field
elements? I can not seem to get any type of XML string to work beyond a simple
feature class or table and have not been able to add subtypes or domains. I
have attached the XML document that I am using to this email. Please see the
<Subtypes> element under the root <esri:DataElement> as well as the <Domain>
under the ELEVATION Field element. Any help or guidance would be greatly
appreciated.
Kind regards,
Adam Gutonski
Sent with [Proton Mail](https://proton.me/) secure email.
<?xml version="1.0" encoding="UTF-8"?>
<esri:DataElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:esri="http://www.esri.com/schemas/ArcGIS/10.1" xsi:type="esri:DEFeatureClass">
<CatalogPath>\TESTPOINT_2</CatalogPath>
<Name>TESTPOINT_2</Name>
<ChildrenExpanded>false</ChildrenExpanded>
<DatasetType>esriDTFeatureClass</DatasetType>
<Versioned>false</Versioned>
<CanVersion>false</CanVersion>
<ConfigurationKeyword/>
<HasOID>true</HasOID>
<OIDFieldName>OBJECTID</OIDFieldName>
<Subtypes xsi:type='esri:ArrayOfSubtype'>
<Subtype xsi:type='esri:Subtype'>
<SubtypeName>Galvanic</SubtypeName>
<SubtypeCode>3</SubtypeCode>
<FieldInfos xsi:type='esri:ArrayOfSubtypeFieldInfo'>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SOURCEACCURACY</FieldName>
<DomainName>Source Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>CONSTRUCTIONSTATUS</FieldName>
<DomainName>Construction Status</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SUBTYPECD</FieldName>
<DomainName></DomainName>
<DefaultValue xsi:type='xs:int'>3</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MATERIAL</FieldName>
<DomainName>Anode Material Type</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SINGLEANODEWEIGHT</FieldName>
<DomainName>Anode Weight</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>INSTALLATIONTYPE</FieldName>
<DomainName>CP Anode Installation Type</DomainName>
<DefaultValue xsi:type='xs:string'>DW</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>BACKFILLTYPE</FieldName>
<DomainName>CP BackFill Type</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>LOCATIONACCURACY</FieldName>
<DomainName>Location Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MABCONSTRUCTIONSTATUS</FieldName>
<DomainName>MAB Construction Status</DomainName>
</SubtypeFieldInfo>
</FieldInfos>
</Subtype>
<Subtype xsi:type='esri:Subtype'>
<SubtypeName>Grounding Cell</SubtypeName>
<SubtypeCode>2</SubtypeCode>
<FieldInfos xsi:type='esri:ArrayOfSubtypeFieldInfo'>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SOURCEACCURACY</FieldName>
<DomainName>Source Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>CONSTRUCTIONSTATUS</FieldName>
<DomainName>Construction Status</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SUBTYPECD</FieldName>
<DomainName></DomainName>
<DefaultValue xsi:type='xs:int'>2</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MATERIAL</FieldName>
<DomainName>Anode Material Type</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SINGLEANODEWEIGHT</FieldName>
<DomainName>Anode Weight</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>INSTALLATIONTYPE</FieldName>
<DomainName>CP Anode Installation Type</DomainName>
<DefaultValue xsi:type='xs:string'>DW</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>BACKFILLTYPE</FieldName>
<DomainName>CP BackFill Type</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>LOCATIONACCURACY</FieldName>
<DomainName>Location Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MABCONSTRUCTIONSTATUS</FieldName>
<DomainName>MAB Construction Status</DomainName>
</SubtypeFieldInfo>
</FieldInfos>
</Subtype>
<Subtype xsi:type='esri:Subtype'>
<SubtypeName>Impressed Current Ground Bed</SubtypeName>
<SubtypeCode>1</SubtypeCode>
<FieldInfos xsi:type='esri:ArrayOfSubtypeFieldInfo'>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SOURCEACCURACY</FieldName>
<DomainName>Source Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>CONSTRUCTIONSTATUS</FieldName>
<DomainName>Construction Status</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SUBTYPECD</FieldName>
<DomainName></DomainName>
<DefaultValue xsi:type='xs:int'>1</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MATERIAL</FieldName>
<DomainName>Anode Material Type</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>SINGLEANODEWEIGHT</FieldName>
<DomainName>Anode Weight</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>INSTALLATIONTYPE</FieldName>
<DomainName>CP Anode Installation Type</DomainName>
<DefaultValue xsi:type='xs:string'>DW</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>BACKFILLTYPE</FieldName>
<DomainName>CP BackFill Type</DomainName>
<DefaultValue xsi:type='xs:string'>UNK</DefaultValue>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>LOCATIONACCURACY</FieldName>
<DomainName>Location Accuracy</DomainName>
</SubtypeFieldInfo>
<SubtypeFieldInfo xsi:type='esri:SubtypeFieldInfo'>
<FieldName>MABCONSTRUCTIONSTATUS</FieldName>
<DomainName>MAB Construction Status</DomainName>
</SubtypeFieldInfo>
</FieldInfos>
</Subtype>
</Subtypes>
<Fields xsi:type="esri:Fields">
<FieldArray xsi:type="esri:ArrayOfField">
<Field xsi:type="esri:Field">
<Name>OBJECTID</Name>
<Type>esriFieldTypeOID</Type>
<IsNullable>false</IsNullable>
<Length>4</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<Required>true</Required>
<Editable>false</Editable>
<AliasName>OBJECTID</AliasName>
<ModelName>OBJECTID</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>SHAPE</Name>
<Type>esriFieldTypeGeometry</Type>
<IsNullable>true</IsNullable>
<Length>0</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<Required>true</Required>
<GeometryDef xsi:type="esri:GeometryDef">
<AvgNumPoints>0</AvgNumPoints>
<GeometryType>esriGeometryPoint</GeometryType>
<HasM>false</HasM>
<HasZ>false</HasZ>
<SpatialReference xsi:type="esri:ProjectedCoordinateSystem">
<WKT>
PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0],AUTHORITY["ESRI",54030]]
</WKT>
<XOrigin>-16987000</XOrigin>
<YOrigin>-8615900</YOrigin>
<XYScale>10000</XYScale>
<ZOrigin>-100000</ZOrigin>
<ZScale>10000</ZScale>
<MOrigin>-100000</MOrigin>
<MScale>10000</MScale>
<XYTolerance>0.001</XYTolerance>
<ZTolerance>0.001</ZTolerance>
<MTolerance>0.001</MTolerance>
<HighPrecision>true</HighPrecision>
<WKID>54030</WKID>
</SpatialReference>
<GridSize0>0</GridSize0>
</GeometryDef>
<AliasName>SHAPE</AliasName>
<ModelName>SHAPE</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>CITY_FIPS</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>5</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>CITY_FIPS</AliasName>
<ModelName>CITY_FIPS</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>CITY_NAME</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>40</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>CITY_NAME</AliasName>
<ModelName>CITY_NAME</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>STATE_FIPS</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>2</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>STATE_FIPS</AliasName>
<ModelName>STATE_FIPS</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>STATE_NAME</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>25</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>STATE_NAME</AliasName>
<ModelName>STATE_NAME</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>STATE_CITY</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>7</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>STATE_CITY</AliasName>
<ModelName>STATE_CITY</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>TYPE</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>25</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>TYPE</AliasName>
<ModelName>TYPE</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>CAPITAL</Name>
<Type>esriFieldTypeString</Type>
<IsNullable>true</IsNullable>
<Length>1</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>CAPITAL</AliasName>
<ModelName>CAPITAL</ModelName>
</Field>
<Field xsi:type="esri:Field">
<Name>ELEVATION</Name>
<Type>esriFieldTypeSmallInteger</Type>
<IsNullable>true</IsNullable>
<Length>2</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>ELEVATION</AliasName>
<ModelName>ELEVATION</ModelName>
<Domain xsi:type='esri:CodedValueDomain'>
<DomainName>Source Accuracy</DomainName>
<FieldType>esriFieldTypeString</FieldType>
<MergePolicy>esriMPTDefaultValue</MergePolicy>
<SplitPolicy>esriSPTDuplicate</SplitPolicy>
<Description></Description>
<Owner></Owner>
<CodedValues xsi:type='esri:ArrayOfCodedValue'>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Map Correction</Name>
<Code xsi:type='xs:string'>Map Correction</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>GSR Conversion</Name>
<Code xsi:type='xs:string'>GSR Conversion</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>GSR</Name>
<Code xsi:type='xs:string'>GSR</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>As-Built</Name>
<Code xsi:type='xs:string'>As-Built</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>MET Map</Name>
<Code xsi:type='xs:string'>GEMS Map</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Operational Change</Name>
<Code xsi:type='xs:string'>OPC</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Pre-Post</Name>
<Code xsi:type='xs:string'>PP</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>A-Form</Name>
<Code xsi:type='xs:string'>AFORM</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Station Report</Name>
<Code xsi:type='xs:string'>STR</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Interference Report</Name>
<Code xsi:type='xs:string'>INTR</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Survey Log</Name>
<Code xsi:type='xs:string'>SL</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>RW Notification</Name>
<Code xsi:type='xs:string'>RW</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Found In Field</Name>
<Code xsi:type='xs:string'>FIF</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>As-Built Conversion</Name>
<Code xsi:type='xs:string'>As-Built Conv</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>Deactivated Sources</Name>
<Code xsi:type='xs:string'>DEACT</Code>
</CodedValue>
<CodedValue xsi:type='esri:CodedValue'>
<Name>CP Sources</Name>
<Code xsi:type='xs:string'>CPS</Code>
</CodedValue>
</CodedValues>
</Domain>
</Field>
<Field xsi:type="esri:Field">
<Name>POP1990</Name>
<Type>esriFieldTypeInteger</Type>
<IsNullable>true</IsNullable>
<Length>4</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<AliasName>POP1990</AliasName>
<ModelName>POP1990</ModelName>
</Field>
</FieldArray>
</Fields>
<Indexes xsi:type="esri:Indexes">
<IndexArray xsi:type="esri:ArrayOfIndex">
<Index xsi:type="esri:Index">
<Name>FDO_OBJECTID</Name>
<IsUnique>true</IsUnique>
<IsAscending>true</IsAscending>
<Fields xsi:type="esri:Fields">
<FieldArray xsi:type="esri:ArrayOfField">
<Field xsi:type="esri:Field">
<Name>OBJECTID</Name>
<Type>esriFieldTypeOID</Type>
<IsNullable>false</IsNullable>
<Length>4</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<Required>true</Required>
<Editable>false</Editable>
<AliasName>OBJECTID</AliasName>
<ModelName>OBJECTID</ModelName>
</Field>
</FieldArray>
</Fields>
</Index>
<Index xsi:type="esri:Index">
<Name>FDO_SHAPE</Name>
<IsUnique>false</IsUnique>
<IsAscending>true</IsAscending>
<Fields xsi:type="esri:Fields">
<FieldArray xsi:type="esri:ArrayOfField">
<Field xsi:type="esri:Field">
<Name>SHAPE</Name>
<Type>esriFieldTypeGeometry</Type>
<IsNullable>true</IsNullable>
<Length>0</Length>
<Precision>0</Precision>
<Scale>0</Scale>
<Required>true</Required>
<GeometryDef xsi:type="esri:GeometryDef">
<AvgNumPoints>0</AvgNumPoints>
<GeometryType>esriGeometryPoint</GeometryType>
<HasM>false</HasM>
<HasZ>false</HasZ>
<SpatialReference xsi:type="esri:ProjectedCoordinateSystem">
<WKT>
PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0],AUTHORITY["ESRI",54030]]
</WKT>
<XOrigin>-16987000</XOrigin>
<YOrigin>-8615900</YOrigin>
<XYScale>10000</XYScale>
<ZOrigin>-100000</ZOrigin>
<ZScale>10000</ZScale>
<MOrigin>-100000</MOrigin>
<MScale>10000</MScale>
<XYTolerance>0.001</XYTolerance>
<ZTolerance>0.001</ZTolerance>
<MTolerance>0.001</MTolerance>
<HighPrecision>true</HighPrecision>
<WKID>54030</WKID>
</SpatialReference>
<GridSize0>115303.299689961</GridSize0>
</GeometryDef>
<AliasName>SHAPE</AliasName>
<ModelName>SHAPE</ModelName>
</Field>
</FieldArray>
</Fields>
</Index>
</IndexArray>
</Indexes>
<CLSID>{52353152-891A-11D0-BEC6-00805F7C4268}</CLSID>
<EXTCLSID/>
<RelationshipClassNames xsi:type="esri:Names"/>
<AliasName/>
<ModelName/>
<HasGlobalID>false</HasGlobalID>
<GlobalIDFieldName/>
<RasterFieldName/>
<ExtensionProperties xsi:type="esri:PropertySet">
<PropertyArray xsi:type="esri:ArrayOfPropertySetProperty"/>
</ExtensionProperties>
<ControllerMemberships xsi:type="esri:ArrayOfControllerMembership"/>
<FeatureType>esriFTSimple</FeatureType>
<ShapeType>esriGeometryPoint</ShapeType>
<ShapeFieldName>SHAPE</ShapeFieldName>
<HasM>false</HasM>
<HasZ>false</HasZ>
<HasSpatialIndex>true</HasSpatialIndex>
<AreaFieldName/>
<LengthFieldName/>
<Extent xsi:nil="true"/>
<SpatialReference xsi:type="esri:ProjectedCoordinateSystem">
<WKT>
PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0],AUTHORITY["ESRI",54030]]
</WKT>
<XOrigin>-16987000</XOrigin>
<YOrigin>-8615900</YOrigin>
<XYScale>10000</XYScale>
<ZOrigin>-100000</ZOrigin>
<ZScale>10000</ZScale>
<MOrigin>-100000</MOrigin>
<MScale>10000</MScale>
<XYTolerance>0.001</XYTolerance>
<ZTolerance>0.001</ZTolerance>
<MTolerance>0.001</MTolerance>
<HighPrecision>true</HighPrecision>
<WKID>54030</WKID>
</SpatialReference>
</esri:DataElement>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev