javascriptarcgis-js-apiarcgis-server

Arcgis for javascript—how to decide what layer to use


Here’s the description of the feature: I got multi-mapserver from the Arcgis Serve,and I want to create a map to display on webbrower,but I don’t know what type is the server is,how can I decide what layer to use when I new a map instance,and add the layer to the map. If u have any idea please help me!!this has drive me crazy!


Solution

  • The REST metadata for a service will tell you whether the service is cached or not. Look for the "Single Fused Map Cache" property.

    If the service is cached (i.e. already has tiles), use the TileLayer. If it's not cached use MapImageLayer.

    Example 1: https://sampleserver6.arcgisonline.com/arcgis/rest/services/MtBaldy_BaseMap/MapServer has "Single Fused Map Cache: true" -> so use TileLayer.

    Example 2: https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer has "Single Fused Map Cache: false" -> so use MapImageLayer.