Create a feature collection layer from a feature collection table, and add it to a map.

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 FeatureCollectionLayer with a Point, Polyline and Polygon geometry. Pan and zoom to explore the scene.
How it works
- Create a
FeatureCollectionTablefor thePoint,Polyline, andPolygongeometry types.- Create the schema for each feature collection table by creating an array of
Fields. - Create a
FeatureCollectionTablewith the fields created. - Create a
SimpleRendererfrom various symbols. - Create a new feature using
makeFeature(attributes:geometry:). - Add the feature to the
FeatureCollectionTable.
- Create the schema for each feature collection table by creating an array of
- Create a
FeatureCollectionfrom theFeatureCollectionTables. - Create a
FeatureCollectionLayerusing the tables. - Add the feature collection layer to the map’s operational layers.
Relevant API
- Feature
- FeatureCollection
- FeatureCollectionLayer
- FeatureCollectionTable
- Field
- SimpleRenderer
Tags
collection, feature, layers, table