View on GitHub Sample viewer app

Load a WFS feature table using an XML query.

Image of load WFS with XML query

Use case

ArcGIS Maps SDKs for Native Apps QueryParameters objects can’t represent all possible queries that can be made against a WFS feature service. For example, ArcGIS Maps SDKs for Native Apps query parameters don’t support wildcard searches. You can provide queries as raw XML strings, allowing you to access query functionality not available with QueryParameters.

How to use the sample

Run the sample and view the data loaded from the WFS feature table.

How it works

  1. Create a WfsFeatureTable and a FeatureLayer to visualize the table.
  2. Set the feature request mode to ManualCache.
  3. Call populateFromServiceAsync() to populate the table with only those features returned by the XML query.

Relevant API

  • FeatureLayer
  • WfsFeatureTable

About the data

This service shows trees in downtown Seattle and the surrounding area. An XML-encoded GetFeature request is used to limit results to only trees of the genus Tilia.

For additional information, see the underlying service on ArcGIS Online.

Tags

feature, OGC, query, service, web, WFS, XML

Sample Code

module-info.java module-info.java WfsXmlQuerySample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.wfs_xml_query {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
// require other modules that the application uses
requires org.apache.commons.io;
exports com.esri.samples.wfs_xml_query;
}