Esri / runtime-questions

Welcome to the 2017 Esri Developer Summit and the session called, "Everything (or Anything) You Wanted to Know About the ArcGIS Runtime SDKs but Were Afraid to Ask"
12 stars 7 forks source link

FeatureService PortalItem Query Layers #136

Closed mrickard26 closed 6 years ago

mrickard26 commented 7 years ago

If I have a PortalItem that is a FeatureService, how can I get the list of layers in that service. In most cases, I want to add a FeatureLayer to my map for each layer of the FeatureService.

.Net

mbranscomb commented 6 years ago

@mrickard26 In the future we would like to enhance the API with an object that represents the FeatureServer endpoint, allowing you to iterate the layers/tables that exposed by the FeatureServer. Additionally there are operations exposed at that level we would like to support such as being able to apply a set of edits for multiple layers/tables in the service and optionally roll back in the event of any failures.

Currently you will need to write code to access that endpoint (JSON) and iterate the layers/tables exposed and then create a FeatureLayer instance for each. For a feature service portal item, the ServiceUrl property returns the FeatureServer endpoint. Appending ?f=pjson will return the JSON e.g. https://gis.internationalmedicalcorps.org/arcgis/rest/services/Nepal/Nepal_Earthquake_2015_data/FeatureServer?f=pjson. From there you can get the collection of layers/tables and iterate those.