我正在尝试使用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();
}
但即使图层具有多个功能,它也始终只返回一个功能。我怎样才能获得多个功能?
我也尝试设置setMaxFeatures
,但没有效果。
主要的是我没有创建FeatureLayer
和MapView
对象,也没有在MapView上添加FeatureLayer。我只想查询ServiceFeatureTable
。
答案 0 :(得分:1)
我认为它正在返回所有功能,但你只是看第一个。尝试更改Function HighlightRows() As Long
Dim c As Long
Dim i As Long
Dim w As Worksheet
Set w = ThisWorkbook.Worksheets("Sheet1")
c = 0
For i = 2 To w.UsedRange.Rows.Count
If w.Cells(i, 11).Value = 1 Then
c = c + 1
w.Rows(i).Interior.ColorIndex = 3
End If
Next i
HighlightRows = c
End Function
:
if
到if (iterator.hasNext()) {
:
while