抽空研究了下API,目前1.4版本,还不错。
记录下
DatasetRelationshipTypes类型
- DatasetRelationshipTypes {string[18]} string[] [0] "SyncDatasetInSyncReplica" string [1] "ReplicaDatasetInReplica" string [2] "DatasetOfReplicaDataset" string [3] "FeatureClassInParcelFabric" string [4] "DatasetsRelatedThrough" string [5] "FeatureClassInTopology" string [6] "DatasetInFolder" string [7] "FeatureClassInGeometricNetwork" string [8] "FeatureClassInNetworkDataset" string [9] "FolderInFolder" string [10] "FeatureClassInTerrain" string [11] "DatasetOfSyncDataset" string [12] "TableInParcelFabric" string [13] "ItemInFolder" string [14] "RepresentationOfFeatureClass" string [15] "DomainInDataset" string [16] "DatasetInFeatureDataset" string [17] "TableInNetworkDataset" string
DataSetTypes类型
- DataSetTypes {string[34]} string[] [0] "Network Dataset" string [1] "Mosaic Dataset" string [2] "Terrain" string [3] "Survey Dataset" string [4] "Dataset" string [5] "Extension Dataset" string [6] "Item" string [7] "Geometric Network" string [8] "Table" string [9] "Sync Replica" string [10] "Workspace" string [11] "Sync Dataset" string [12] "Resource" string [13] "Tin" string [14] "Feature Dataset" string [15] "Coded Value Domain" string [16] "Representation Class" string [17] "Replica Dataset" string [18] "Raster Dataset" string [19] "Historical Marker" string [20] "AbstractTable" string [21] "Catalog Dataset" string [22] "Range Domain" string [23] "Replica" string [24] "Feature Class" string [25] "Toolbox" string [26] "Topology" string [27] "Relationship Class" string [28] "Parcel Fabric" string [29] "Raster Catalog" string [30] "Schematic Dataset" string [31] "Workspace Extension" string [32] "Domain" string [33] "Folder" string
demo代码如下
string db = @"Z:dataDK.gdb"; Geodatabase geodatabase = Geodatabase.Open(@"Z:dataDK.gdb"); string[] pArrayDST = geodatabase.DataSetTypes; string[] pArrayDRT = geodatabase.DatasetRelationshipTypes; string[] pArrayFC = geodatabase.GetChildDatasets("\", "Feature Class"); string[] pArrayFD = geodatabase.GetChildDatasets("\", "Feature Dataset"); string[] pArrayFC2 = geodatabase.GetChildDatasets(pArrayFD[0], "Feature Class");
目前,对于字段别名有点问题,FieldDefs始终为null,至于FieldInformation中,没有字段别名。估计是漏掉了?
这个问题倒是好解决,做一张字段对照表,导出的时候就可以了。
看demo会发现,似乎esri对这个api采用的是py的路子,通过字符串进行识别,把gdb当作文件夹来操作。
而且对于创建表之类的采用了xml思路,如果不是偷懒,就是为了跨平台。