View in MAUI UWP WPF WinUI View on GitHub
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

Create a Feature Collection Layer from a Feature Collection Table, and add it to a map.

screenshot

Use case

A Feature Collection allows easily importing external data (such as CSV files), as well as creating custom schema for data that is in non-standardized format. This data can then be used to populate a Feature Collection Table, and displayed in a Feature Collection Layer using the attributes and geometries provided in the external data source. For example, an electricity supplier could use this functionality to visualize existing location data of coverage areas (polygons), power stations (points), transmission lines (polylines), and others.

How to use the sample

When launched, this sample displays a

with a
,
and
geometry.

How it works

  1. Create a
    using a new feature collection,
  2. Add the feature collection layer to the map,
    .
  3. Create a
    for the
    s
    ,
    , and
    ,
    • Additionally, pass in a list of
      objects to represent the table’s schema. In this case a field of type String named
      is added.
  4. Assign a
    to each table to render any
    s from that table using the
    that was set.
  5. Add the feature collection table to the feature collection,
    .
  6. Use the
    method to create a feature from the feature collection table, passing an attribute and geometry for that feature,
    .
  7. Add new features to the table,
    .

Relevant API

  • Feature
  • FeatureCollection
  • FeatureCollectionLayer
  • FeatureCollectionTable
  • Field
  • SimpleRenderer

Tags

feature collection, layers

Sample Code

CreateFeatureCollectionLayer.xaml CreateFeatureCollectionLayer.xaml CreateFeatureCollectionLayer.xaml.cs
<UserControl x:Class="ArcGIS.WinUI.Samples.CreateFeatureCollectionLayer.CreateFeatureCollectionLayer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
</Grid>
</UserControl>