【问题标题】:How to get Coded Values from Coded Value Domain in Android Runtime SDK 100.0.0?如何从 Android Runtime SDK 100.0.0 中的编码值域获取编码值?
【发布时间】: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


    【解决方案1】:

    从地理数据库获取要素类的编码域有点复杂。 以下是获取它的示例代码。这适用于离线地理数据库(运行时内容),对于来自使用 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

    【讨论】:

      猜你喜欢
      • 2012-09-07
      • 2016-12-10
      • 2019-05-10
      • 2020-06-29
      • 1970-01-01
      • 2010-11-15
      • 2017-08-27
      • 2011-05-15
      • 1970-01-01
      相关资源
      最近更新 更多