View on GitHub Sample viewer app

Display a layer from a WFS service, requesting only features for the current extent.

Image of display WFS layer

Use case

WFS is an open standard with functionality similar to ArcGIS feature services. The ArcGIS Maps SDKs for Native Apps support for WFS allows you to interoperate with open systems, which are often used in inter-agency efforts, like those for disaster relief.

How to use the sample

Pan and zoom to see features within the current map extent.

How it works

  1. Create a WfsFeatureTable with a URL.
  2. Create a FeatureLayer from the feature table and add it to the map.
  3. Add a NavigationChangedListener to the map view to listen for a NavigationChangedEvent. Check if it !isNavigating() to detect when the user has stopped navigating the map.
  4. When the user is finished navigating, use populateFromServiceAsync(...) to load the table with data for the current visible extent.

Relevant API

  • FeatureLayer
  • NavigationChangedEvent
  • QueryParameters
  • WfsFeatureTable

About the data

This service shows building footprints for downtown Seattle. For additional information, see the underlying service on ArcGIS Online.

Tags

browse, catalog, feature, interaction cache, layers, OGC, service, web, WFS

Sample Code

module-info.java module-info.java DisplayWFSLayerSample.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.display_wfs_layer {
// 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;
exports com.esri.samples.display_wfs_layer;
}