我正在尝试使用arcgis-java
(ArcGIS Runtime)查询 ArcGIS Online 要素图层,如下所示:
ServiceFeatureTable featureTable = new ServiceFeatureTable(this.SERVICE_FEATURE_URL);
QueryParameters query = new QueryParameters();
query.setWhereClause("1=1");
query.setReturnGeometry(true);
ListenableFuture<FeatureQueryResult> queryFeaturesAsync = featureTable.queryFeaturesAsync(query);
try {
FeatureQueryResult result = queryFeaturesAsync.get();
Iterator<Feature> iterator = result.iterator();
if (iterator.hasNext()) {
Feature feature = iterator.next();
System.out.println(feature.getAttributes());
System.out.println(feature.getGeometry());
}
} catch (Exception e) {
e.printStackTrace();
}
但它总是只返回一个特征,即使该层有超过 1 个特征。如何获得多个功能?
我也尝试通过设置setMaxFeatures
也但没有效果。
主要的是我没有创建FeatureLayer
和MapView
对象,也没有在 MapView 上添加 FeatureLayer。我只是想查询ServiceFeatureTable
.