【发布时间】:2017-10-02 18:33:33
【问题描述】:
ArcGIS 具有将编码值域添加到要素类字段的功能。
此要素类可在 Android 设备上使用 ArcGIS Runtime SDK for Android 使用。
我想知道如何使用 ArcGIS Runtime SDK for Android 100.0.0 从编码值域中检索该要素类中某个字段的编码值?
【问题讨论】:
标签: android android-studio esri
ArcGIS 具有将编码值域添加到要素类字段的功能。
此要素类可在 Android 设备上使用 ArcGIS Runtime SDK for Android 使用。
我想知道如何使用 ArcGIS Runtime SDK for Android 100.0.0 从编码值域中检索该要素类中某个字段的编码值?
【问题讨论】:
标签: android android-studio esri
从地理数据库获取要素类的编码域有点复杂。 以下是获取它的示例代码。这适用于离线地理数据库(运行时内容),对于来自使用 ServiceFeatureTable 类的服务的地理数据库也可以这样做。
//Open the geodatabase file
String path = "/storage/emulated/0/testdomainclass.geodatabase"; // path to the offline runtime content on android device
geodatabase = null;
geodatabase = new Geodatabase(path);
geodatabase.loadAsync();
// add feature layer from geodatabase to the ArcGISMap
geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTable("points"); // name of the feature class insife the runtime content
geodatabaseFeatureTable.loadAsync();
Field field = geodatabaseFeatureTable.getField("name"); // name of the field for which the domain is created
Domain domain = field.getDomain();
CodedValueDomain codedValueDomain = ((CodedValueDomain) domain);
List<CodedValue> codedvaluelist = codedValueDomain.getCodedValues();
在上面的例子中,codedvaluelist 对象将包含名称和可以使用以下代码检索的代码:
codedvaluelist.get(0).getName(); //name of codedvalue at 0 index
codedvaluelist.get(0).getCode(); // code of codedvalue at 0 index
您也可以查看我的 geonet 帖子。 How to get coded values from coded value domain
【讨论】: