为什么此 ArcGIS 查询中的每个属性(OBJECTID 除外)都返回 null?

问题描述 投票:0回答:1

我正在尝试使用 ArcGis API 在 android Studio 中构建一个应用程序。在构建适配器时,我注意到,除了“OBJECTID”之外的所有属性都返回 null,即使它们实际上有内容。它也没有返回每个属性。 本质上,该查询向服务器询问用户周围 1000m 区域内的要素。这本身是有效的,它创建了 3 个障碍物。 有谁知道如何解决此问题或使用 OBJECTID 获取其他属性吗? 非常感谢帮助! 预先感谢

public void queryFeatures(Location location, int radius){
    double userLat = location.getLatitude();
    double userLon = location.getLongitude();
    com.esri.arcgisruntime.geometry.Point userLocation = new com.esri.arcgisruntime.geometry.Point(userLon, userLat, SpatialReferences.getWgs84());
    LinearUnit unit = new LinearUnit(LinearUnitId.METERS);
    // Defining a circle around the users position
    Geometry bufferGeometry = GeometryEngine.bufferGeodetic(userLocation, radius, unit, Double.NaN, GeodeticCurveType.GEODESIC);

    // Defining the query paramteres
    QueryParameters queryParameters = new QueryParameters();
    queryParameters.setGeometry(bufferGeometry);
    queryParameters.setSpatialRelationship(QueryParameters.SpatialRelationship.INTERSECTS);

    // the actual query
    final ListenableFuture<FeatureQueryResult> queryResult = mServiceFeatureTable.queryFeaturesAsync(queryParameters);
    queryResult.addDoneListener(() -> {
        try {
            FeatureQueryResult result = queryResult.get();
            for (Feature feature : result){
                if (Obstacle.doesObstacleExist((ArcGISFeature) feature)) {
                    ArcGISFeature arcGISFeature = (ArcGISFeature) feature;
                    Map attr = arcGISFeature.getAttributes();
                    locationManager.addObserver(new Obstacle((ArcGISFeature) feature));
                }
            }
        } catch (Exception e) {
            Log.d("featurequery", e.getMessage());
        }
    });
}
java android-studio arcgis esri arcgis-android-api
1个回答
0
投票

我认为你应该添加一个参数

mServiceFeatureTable.queryFeaturesAsync(queryParameters, ServiceFeatureTable.QueryFeatureFields.LOAD_ALL
© www.soinside.com 2019 - 2024. All rights reserved.