I am currently working with a web app, which could allow the users to log in with their ArcGIS Online Accounts and draw their contents on the map. The confusing part of this process is that it is really hard to determine which Function should I use to draw the layer. I come up with a matrix about the most used layers, and which function that needed to be used based on item's metadata. This might be incomplete:
type | displayName | ArcGIS Function | URL(ID) to Use |
Web Map | Web Map | Map | itemid |
KML | KML | KMLLayer | itemDataUrl |
Feature Service | Feature layer | FeatureLayer | url |
Feature Collection | Feature layer | FeatureLayer | itemDataUrl |
Image Service | Imagery Layer | ArcGISImageServiceLayer | url |
Vector Tile Service | Tile Layer | VectorTileLayer | url |
Map Service | Tile Layer | ArcGISTiledMapServiceLayer | url |
Map Service | Map Image Layer | ArcGISDynamicMapServiceLayer | url |
Any suggestions for the best practice for this problem?
Thanks
Solved! Go to Solution.
There's a Layer.fromPortalItem function in 4.XX but not in 3.XX as far as I know. You may just have to call a different function based on the item type for each item in my contents.
There's a Layer.fromPortalItem function in 4.XX but not in 3.XX as far as I know. You may just have to call a different function based on the item type for each item in my contents.
Yep, 4.x beat 3.x in this aspect. I am just so confused about the either "displayName" or "type" of a item cannot determine the resource "Real" type individually.