You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a Feature Collection Layer from a Feature Collection Table, and add it to a map.
4
+
5
+

6
+
7
+
## Use case
8
+
9
+
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.
10
+
11
+
## How to use the sample
12
+
13
+
When launched, this sample displays a `FeatureCollectionLayer` with a `ArcGISPoint`, `Polyline` and `Polygon` geometry. Pan and zoom to explore the scene.
14
+
15
+
## How it works
16
+
17
+
1. Create a `FeatureCollectionTable` for the `GeometryType`s `ArcGISPoint`, `Polyline`, and `Polygon`, using `FeatureCollectionTable(fields, geometryType, spatialReference)`, passing in a list of `Field` objects to represent the table's schema, the `GeometryType`, and a `SpatialReference`.
18
+
2. Assign a `SimpleRenderer` to each table to render any `Feature`s from that table using the `Symbol` that was set.
19
+
3. Use the `FeatureCollectionTable.createFeature(attributes, geometry)` method to create a feature from the feature collection table, passing an attribute and geometry for that feature.
20
+
4. Add new features to the table, `FeatureCollectionTable.addFeature(feature)`.
21
+
5. Add the feature collection table to the feature collection, `FeatureCollection.tables.add(featureCollectionTable)`.
22
+
6. Create a `FeatureCollectionLayer` using the feature collection, `FeatureCollectionLayer.withFeatureCollection(featureCollection)`.
23
+
7. Add the feature collection layer to the map, `ArcGISMap.operationalLayers.add(featureCollectionLayer)`.
0 commit comments