android arcgis - create feature layer without URL

972
3
07-30-2019 12:08 PM
Gharding
New Contributor

The reference for my question is the ESRI android arcgisruntime example
SceneLayerSelection - a user interactively selects
a building from the scene.
The following line loads the buildings using a URL:
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(buildingsURL);

But we want to create a feature layer - or a ServiceFeatureTable - without using a URL
for the feature data source.
For example, we would like to generate a JSON string of our
features and use it to build the feature layer.
Is this possible and if so how is it done?

Thank you for your help.

Jack

Tags (1)
0 Kudos
3 Replies
Nicholas-Furness
Esri Regular Contributor

You should use a FeatureCollectionTable.

See this sample: arcgis-runtime-samples-android/java/feature-collection-layer at d1b8c9fc335299899653b30ca4cfa8d4b162... 

In summary…

Create a FeatureCollectionTable with the geometry type, attributes, and spatial reference you need. Then create a FeatureCollection, passing in the table, and create a FeatureCollectionLayer passing in that FeatureCollection. Add that FeatureCollectionLayer to the map's operational layers.

This pattern allows you to create arbitrary in-memory tables.


That FeatureCollectionLayer will have a set of sublayers. Each sublayer represents a source FeatureCollectionTable.

Note that you can specify a renderer on the FeatureCollectionTable before you pass it to the FeatureCollection - that can make it easier to organize your renderers if you have multiple tables in your feature collection.

Note also that you can add FeatureCollectionTables to the FeatureCollection after you have created the FeatureCollectionLayer.

If you are getting your Features from some other query to an ArcGIS service, note that there's a FeatureCollectionTable constructor that takes a FeatureSet. This can simplify creating that initial FeatureCollectionTable for certain use-cases.

Hope that helps!

0 Kudos
Gharding
New Contributor

Nicholas - thank you so much for your response - Jack

On Wednesday, July 31, 2019, 10:00:22 AM PDT, Nicholas Furness <geonet@esri.com> wrote:

|

GeoNet, The Esri Community

GIS and Geospatial Professional Community

|

Re: android arcgis - create feature layer without URL

reply from Nicholas Furness in ArcGIS Runtime SDK for Android - View the full discussion

You should use a FeatureCollectionTable.

 

See this sample: arcgis-runtime-samples-android/java/feature-collection-layer at d1b8c9fc335299899653b30ca4cfa8d4b162d7e8 · Esri/arcgis-r… 

 

In summary…

 

Create a FeatureCollectionTable with the geometry type, attributes, and spatial reference you need. Then create a FeatureCollection, passing in the table, and create a FeatureCollectionLayer passing in that FeatureCollection. Add that FeatureCollectionLayer to the map's operational layers.

 

This pattern allows you to create arbitrary in-memory tables.

That FeatureCollectionLayer will have a set of sublayers. Each sublayer represents a source FeatureCollectionTable.

 

Note that you can specify a renderer on the FeatureCollectionTable before you pass it to the FeatureCollection - that can make it easier to organize your renderers if you have multiple tables in your feature collection.

 

Note also that you can add FeatureCollectionTables to the FeatureCollection after you have created the FeatureCollectionLayer.

 

If you are getting your Features from some other query to an ArcGIS service, note that there's a FeatureCollectionTable constructor that takes a FeatureSet. This can simplify creating that initial FeatureCollectionTable for certain use-cases.

 

Hope that helps!

Reply to this message by replying to this email, or go to the message on GeoNet, The Esri Community

GIS and Geospatial Professional Community

Start a new discussion in ArcGIS Runtime SDK for Android by email or at GeoNet, The Esri Community

GIS and Geospatial Professional Community

Following Re: android arcgis - create feature layer without URL in these streams: Inbox

This email was sent by GeoNet, The Esri Community | GIS and Geospatial Professional Community because you are a registered user.

You may unsubscribe instantly from GeoNet, The Esri Community | GIS and Geospatial Professional Community, or adjust email frequency in your email preferences

0 Kudos
Gharding
New Contributor

The feature collection and table is createdand is properly displayed - thank you for your help.Other ESRI feature selection examples typicallyuse a service feature table and a feature layer:  final ListenableFuture wrote:

|

GeoNet, The Esri Community

GIS and Geospatial Professional Community

|

Re: android arcgis - create feature layer without URL

reply from Nicholas Furness in ArcGIS Runtime SDK for Android - View the full discussion

You should use a FeatureCollectionTable.

 

See this sample: arcgis-runtime-samples-android/java/feature-collection-layer at d1b8c9fc335299899653b30ca4cfa8d4b162d7e8 · Esri/arcgis-r… 

 

In summary…

 

Create a FeatureCollectionTable with the geometry type, attributes, and spatial reference you need. Then create a FeatureCollection, passing in the table, and create a FeatureCollectionLayer passing in that FeatureCollection. Add that FeatureCollectionLayer to the map's operational layers.

 

This pattern allows you to create arbitrary in-memory tables.

That FeatureCollectionLayer will have a set of sublayers. Each sublayer represents a source FeatureCollectionTable.

 

Note that you can specify a renderer on the FeatureCollectionTable before you pass it to the FeatureCollection - that can make it easier to organize your renderers if you have multiple tables in your feature collection.

 

Note also that you can add FeatureCollectionTables to the FeatureCollection after you have created the FeatureCollectionLayer.

 

If you are getting your Features from some other query to an ArcGIS service, note that there's a FeatureCollectionTable constructor that takes a FeatureSet. This can simplify creating that initial FeatureCollectionTable for certain use-cases.

 

Hope that helps!

Reply to this message by replying to this email, or go to the message on GeoNet, The Esri Community

GIS and Geospatial Professional Community

Start a new discussion in ArcGIS Runtime SDK for Android by email or at GeoNet, The Esri Community

GIS and Geospatial Professional Community

Following Re: android arcgis - create feature layer without URL in these streams: Inbox

This email was sent by GeoNet, The Esri Community | GIS and Geospatial Professional Community because you are a registered user.

You may unsubscribe instantly from GeoNet, The Esri Community | GIS and Geospatial Professional Community, or adjust email frequency in your email preferences

0 Kudos