Click or drag to resize

WfsFeatureTable Class

Represents a table in an OGC Web Feature Service.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Data
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
C#
public sealed class WfsFeatureTable : FeatureTable

The WfsFeatureTable type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleWfsFeatureTable(WfsLayerInfo)
Initializes a new instance of the WfsFeatureTable class from a WFS layer info object.
Public methodCode exampleWfsFeatureTable(Uri, String)
Initializes a new instance of the WfsFeatureTable class.
Top
Properties
  NameDescription
Public propertyCode exampleAxisOrder
Gets or sets the axis order, which defines how coordinates are interpreted (X,Y or Y,X).
Public propertyDisplayName
Gets or sets the table's display name.
(Inherited from FeatureTable.)
Public propertyCode exampleExtent
Gets the geographic extent of features within the table.
(Inherited from FeatureTable.)
Public propertyFeatureLayer
Gets the FeatureLayer this table is associated with, or created from, if any.
(Inherited from FeatureTable.)
Public propertyCode exampleFeatureRequestMode
Gets or sets the mode defining when features are requested from the service.
Public propertyCode exampleFields
Gets the fields of the feature table.
(Inherited from FeatureTable.)
Public propertyFilterAxisOrder
Gets or sets the filter axis order, which determines how coordinates are ordered when sent to the server as part of spatial queries.
Public propertyCode exampleGeometryType
Gets the GeometryType of features in this table.
(Inherited from FeatureTable.)
Public propertyHasGeometry
Gets a value indicating whether this table has geometry data.
(Inherited from FeatureTable.)
Public propertyHasM
Gets a value indicating whether the shapefile geometries have M values.
(Inherited from FeatureTable.)
Public propertyHasZ
Gets a value indicating whether the shapefile geometries have Z values.
(Inherited from FeatureTable.)
Public propertyIsEditable
Gets a value indicating whether this table is editable.
(Inherited from FeatureTable.)
Public propertyIsPopupEnabled
Gets or sets a value indicating whether the PopupDefinition defined is enabled.
(Inherited from FeatureTable.)
Public propertyLayer
Gets the layer this table is associated with, or created from, if any.
(Inherited from FeatureTable.)
Public propertyLayerInfo
Returns the WFS layer information.
Public propertyLoadError
Gets the exception associated with a failed load. This property remains null if load is successful.
(Inherited from FeatureTable.)
Public propertyCode exampleLoadStatus
Gets the current load status.
(Inherited from FeatureTable.)
Public propertyNumberOfFeatures
Gets the number of features in this table.
(Inherited from FeatureTable.)
Public propertyPopupDefinition
Gets or sets the pop-up definition for the table.
(Inherited from FeatureTable.)
Public propertyPreferredSpatialReference
Gets or sets the preferred spatial reference for the table.
Public propertySource
Gets the service Uri.
Public propertySpatialReference
Gets the SpatialReference of this table.
(Inherited from FeatureTable.)
Public propertyCode exampleTableName
Gets the name of the table.
(Inherited from FeatureTable.)
Top
Methods
  NameDescription
Public methodCode exampleAddFeatureAsync
Asynchronously adds new Feature to the table.
(Inherited from FeatureTable.)
Public methodAddFeaturesAsync
Asynchronously adds the set of Features to the table.
(Inherited from FeatureTable.)
Public methodCanAdd
Determines if a feature can be added to the table.
(Inherited from FeatureTable.)
Public methodCancelLoad
Cancel the previous load operation,
(Inherited from FeatureTable.)
Public methodCanDelete
Determines if the specified Feature can be deleted from the table.
(Inherited from FeatureTable.)
Public methodCanEditGeometry
Determines if the table allows for the geometry field to be modified.
(Inherited from FeatureTable.)
Public methodCanUpdate
Determines if the specified Feature can be updated on the table.
(Inherited from FeatureTable.)
Public methodCode exampleCreateFeature
Creates a new feature.
(Inherited from FeatureTable.)
Public methodCreateFeature(IEnumerableKeyValuePairString, Object, Geometry)
Creates a new feature with specified attributes and geometry.
(Inherited from FeatureTable.)
Public methodCode exampleDeleteFeatureAsync
Asynchronously deletes new Feature from the table.
(Inherited from FeatureTable.)
Public methodDeleteFeaturesAsync
Asynchronously deletes the set of Features from the table.
(Inherited from FeatureTable.)
Public methodGetField
Gets the associated Field with specified field name.
(Inherited from FeatureTable.)
Public methodCode exampleLoadAsync
Asynchronously initiates loading of this table.
(Inherited from FeatureTable.)
Public methodCode examplePopulateFromServiceAsync(String, Boolean)
Asynchronously populates the table using an XML query.
Public methodPopulateFromServiceAsync(String, Boolean, CancellationToken)
Asynchronously populates the table using an XML query.
Public methodCode examplePopulateFromServiceAsync(QueryParameters, Boolean, IEnumerableString)
Asynchronously populates the table using a query.
Public methodPopulateFromServiceAsync(QueryParameters, Boolean, IEnumerableString, CancellationToken)
Asynchronously populates the table using a query.
Public methodCode exampleQueryExtentAsync
Asynchronously queries the extent of all features that satisfy the provided parameters.
(Inherited from FeatureTable.)
Public methodCode exampleQueryFeatureCountAsync
Asynchronously queries the count of all features that satisfy the provided parameters.
(Inherited from FeatureTable.)
Public methodCode exampleQueryFeaturesAsync(QueryParameters)
Asynchronously performs query against the table.
(Inherited from FeatureTable.)
Public methodQueryFeaturesAsync(QueryParameters, CancellationToken)
Asynchronously performs query against the table.
(Inherited from FeatureTable.)
Public methodCode exampleQueryStatisticsAsync
Calculates values for the requested statistics.
(Inherited from FeatureTable.)
Public methodRetryLoadAsync
Asynchronously retries loading of this table table.
(Inherited from FeatureTable.)
Public methodCode exampleUpdateFeatureAsync
Asynchronously updates new Feature on the table.
(Inherited from FeatureTable.)
Public methodUpdateFeaturesAsync
Asynchronously updates the set of Features on the table.
(Inherited from FeatureTable.)
Top
Events
  NameDescription
Public eventCode exampleLoaded
Occurs when the table is loaded.
(Inherited from FeatureTable.)
Public eventCode exampleLoadStatusChanged
Occurs when the table LoadStatus is changed.
(Inherited from FeatureTable.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from FeatureTable.)
Top
Examples

Android

Example Name: DisplayWfs

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

Code example screen shot.

C#
// Copyright 2019 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.

using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Drawing;
using Debug = System.Diagnostics.Debug;

namespace ArcGISRuntimeXamarin.Samples.DisplayWfs
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Display a WFS layer",
        "Layers",
        "Display a layer from a WFS service, requesting only features for the current extent.",
        "")]
    public class DisplayWfs : Activity
    {
        // Hold references to the UI controls.
        private MapView _myMapView;
        private ProgressBar _loadingProgressBar;

        // Hold a reference to the WFS feature table.
        private WfsFeatureTable _featureTable;

        // Constants for the service URL and layer name.
        private const string ServiceUrl = "https://dservices2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/services/Seattle_Downtown_Features/WFSServer?service=wfs&request=getcapabilities";
        // Note that the layer name is defined by the service. The layer name can be accessed via WfsLayerInfo.Name. 
        private const string LayerName = "Seattle_Downtown_Features:Buildings";

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "Display a WFS layer";

            CreateLayout();
            Initialize();
        }

        private async void Initialize()
        {
            // Create the map with topographic basemap.
            _myMapView.Map = new Map(Basemap.CreateTopographic());

            try
            {
                // Create the feature table from URI and layer name.
                _featureTable = new WfsFeatureTable(new Uri(ServiceUrl), LayerName);

                // Set the feature request mode to manual - only manual is supported at v100.5.
                // In this mode, you must manually populate the table - panning and zooming won't request features automatically.
                _featureTable.FeatureRequestMode = FeatureRequestMode.ManualCache;

                // Load the table.
                await _featureTable.LoadAsync();

                // Create a feature layer to visualize the WFS features.
                FeatureLayer wfsFeatureLayer = new FeatureLayer(_featureTable);

                // Apply a renderer.
                wfsFeatureLayer.Renderer = new SimpleRenderer(new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Red, 3));

                // Add the layer to the map.
                _myMapView.Map.OperationalLayers.Add(wfsFeatureLayer);

                // Use the navigation completed event to populate the table with the features needed for the current extent.
                _myMapView.NavigationCompleted += MapView_NavigationCompleted;

                // Zoom to a small area within the dataset by default.
                MapPoint topLeft = new MapPoint(-122.341581, 47.617207, SpatialReferences.Wgs84);
                MapPoint bottomRight = new MapPoint(-122.332662, 47.613758, SpatialReferences.Wgs84);
                await _myMapView.SetViewpointGeometryAsync(new Envelope(topLeft, bottomRight));
            }
            catch (Exception e)
            {
                new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Couldn't load sample.").Show();
                Debug.WriteLine(e);
            }
        }

        private async void MapView_NavigationCompleted(object sender, EventArgs e)
        {
            // Show the loading bar.
            _loadingProgressBar.Visibility = ViewStates.Visible;

            // Get the current extent.
            Envelope currentExtent = _myMapView.VisibleArea.Extent;

            // Create a query based on the current visible extent.
            QueryParameters visibleExtentQuery = new QueryParameters();
            visibleExtentQuery.Geometry = currentExtent;
            visibleExtentQuery.SpatialRelationship = SpatialRelationship.Intersects;

            try
            {
                // Populate the table with the query, leaving existing table entries intact.
                // Setting outFields to null requests all features.
                await _featureTable.PopulateFromServiceAsync(visibleExtentQuery, false, null);
            }
            catch (Exception exception)
            {
                new AlertDialog.Builder(this).SetMessage(exception.ToString()).SetTitle("Couldn't populate table.").Show();
                Debug.WriteLine(exception);
            }
            finally
            {
                // Hide the loading bar.
                _loadingProgressBar.Visibility = ViewStates.Gone;
            }
        }

        private void CreateLayout()
        {
            // Create a new vertical layout for the app.
            var layout = new LinearLayout(this) { Orientation = Orientation.Vertical };

            // Add a help label.
            TextView helpLabel = new TextView(this);
            helpLabel.Gravity = GravityFlags.Center;
            helpLabel.Text = "Pan and zoom to see features.";
            layout.AddView(helpLabel);

            // Add a progress bar.
            _loadingProgressBar = new ProgressBar(this);
            _loadingProgressBar.Indeterminate = true;
            _loadingProgressBar.Visibility = ViewStates.Gone;
            layout.AddView(_loadingProgressBar);

            // Add the map view to the layout.
            _myMapView = new MapView(this);
            layout.AddView(_myMapView);

            // Show the layout in the app.
            SetContentView(layout);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: DisplayWfs

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

Code example screen shot.

C#
// Copyright 2019 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.

using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System;
using System.Diagnostics;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.DisplayWfs
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Display a WFS layer",
        "Layers",
        "Display a layer from a WFS service, requesting only features for the current extent.",
        "")]
    public partial class DisplayWfs : ContentPage
    {
        // Hold a reference to the WFS feature table.
        private WfsFeatureTable _featureTable;

        // Constants for the service URL and layer name.
        private const string ServiceUrl = "https://dservices2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/services/Seattle_Downtown_Features/WFSServer?service=wfs&request=getcapabilities";
        // Note that the layer name is defined by the service. The layer name can be accessed via WfsLayerInfo.Name. 
        private const string LayerName = "Seattle_Downtown_Features:Buildings";

        public DisplayWfs()
        {
            InitializeComponent();
            Initialize();
        }

        private async void Initialize()
        {
            // Create the map with topographic basemap.
            MyMapView.Map = new Map(Basemap.CreateTopographic());

            try
            {
                // Create the feature table from URI and layer name.
                _featureTable = new WfsFeatureTable(new Uri(ServiceUrl), LayerName);

                // Set the feature request mode to manual - only manual is supported at v100.5.
                // In this mode, you must manually populate the table - panning and zooming won't request features automatically.
                _featureTable.FeatureRequestMode = FeatureRequestMode.ManualCache;

                // Load the table.
                await _featureTable.LoadAsync();

                // Create a feature layer to visualize the WFS features.
                FeatureLayer wfsFeatureLayer = new FeatureLayer(_featureTable);

                // Apply a renderer.
                wfsFeatureLayer.Renderer = new SimpleRenderer(new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Red, 3));

                // Add the layer to the map.
                MyMapView.Map.OperationalLayers.Add(wfsFeatureLayer);

                // Use the navigation completed event to populate the table with the features needed for the current extent.
                MyMapView.NavigationCompleted += MapView_NavigationCompleted;

                // Zoom to a small area within the dataset by default.
                MapPoint topLeft = new MapPoint(-122.341581, 47.617207, SpatialReferences.Wgs84);
                MapPoint bottomRight = new MapPoint(-122.332662, 47.613758, SpatialReferences.Wgs84);
                await MyMapView.SetViewpointGeometryAsync(new Envelope(topLeft, bottomRight));
            }
            catch (Exception e)
            {
                await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "Couldn't load sample.");
                Debug.WriteLine(e);
            }
        }

        private async void MapView_NavigationCompleted(object sender, EventArgs e)
        {
            // Show the loading bar.
            LoadingProgressBar.IsVisible = true;

            // Get the current extent.
            Envelope currentExtent = MyMapView.VisibleArea.Extent;

            // Create a query based on the current visible extent.
            QueryParameters visibleExtentQuery = new QueryParameters();
            visibleExtentQuery.Geometry = currentExtent;
            visibleExtentQuery.SpatialRelationship = SpatialRelationship.Intersects;

            try
            {
                // Populate the table with the query, leaving existing table entries intact.
                // Setting outFields to null requests all features.
                await _featureTable.PopulateFromServiceAsync(visibleExtentQuery, false, null);
            }
            catch (Exception exception)
            {
                await Application.Current.MainPage.DisplayAlert("Error", exception.ToString(), "Couldn't populate table.");
                Debug.WriteLine(exception);
            }
            finally
            {
                // Hide the loading bar.
                LoadingProgressBar.IsVisible = false;
            }
        }
    }
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:resources="clr-namespace:Forms.Resources;assembly=ArcGISRuntime"
             x:Class="ArcGISRuntimeXamarin.Samples.DisplayWfs.DisplayWfs">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView" Style="{StaticResource MapWithFormStyle}"
                        BindingContext="{x:Reference Name=ResponsiveFormContainer}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <StackLayout>
                <Label Text="Pan and zoom to see features."
                       HorizontalTextAlignment="Center" />
                <ActivityIndicator x:Name="LoadingProgressBar" 
                             IsEnabled="True"
                             IsRunning="True"
                             IsVisible="False" />
            </StackLayout>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
BrowseWfsLayersBrowse a WFS service for layers.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
WfsXmlQueryLoad a WFS feature table using an XML query.