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

MapService PortalItem and layer type #128

Closed mrickard26 closed 7 years ago

mrickard26 commented 7 years ago

Given a PortalItem of type MapService, how do I know what layer type I should create and add to my map? ArcGISMapImageLayer, ArcGISTiledLayer, etc. .Net

willcrick commented 7 years ago

In v100 you have to work this out yourself. We have talked about and designed a factory method to do this for you in a future release (e.g. Layer.createFromPortalItem).

You will have to create a map image layer from the portal item, get its service info and work out if its tiled or not. If its a tiled service, you can then check the spatial reference of the layer compared to the map, if they are the same, you should use a tiled layer, if they are different use a map image layer.