Namespace: esri.arcgis.utils

Description

dojo.require("esri.arcgis.utils");
The esri.arcgis.utils namespace has several utility methods to work with maps from ArcGIS.com.

Samples

Search for samples that use this class.  

Methods

Method Return Value Description
esri.arcgis.utils.createMap(itemId/itemInfo, mapDiv, options?) dojo.Deferred

Create a map using information from an ArcGIS.com item. At version 2.0 an object with the following specification will be passed to the callback.

{
  map:<esri.Map>
}

At version 2.1 the response object also includes itemInfo, an array of information about each layer.

{
  map: <esri.Map>,
  itemInfo:{
    item: <Object>,
    itemData:<Object>
  }
}
The createMap method appends base for all basemap layers and operational for operational layers to the index of each layer in the map. This allows you to easily access either the basemap or operational layers.
  var layers = response.itemInfo.itemData.operationalLayers;

esri.arcgis.utils.getItem(itemId) dojo.Deferred

Get details about the input ArcGIS.com item. An object with the following specification is passed to the callback:

{
  item: <Object>,
  itemData: <Object>
}
Methods Detail

esri.arcgis.utils.createMap(itemId/itemInfo, mapDiv, options?)

Create a map using information from an ArcGIS.com item. At version 2.0 an object with the following specification will be passed to the callback.

{
  map:<esri.Map>
}

At version 2.1 the response object also includes itemInfo, an array of information about each layer.

{
  map: <esri.Map>,
  itemInfo:{
    item: <Object>,
    itemData:<Object>
  }
}
The createMap method appends base for all basemap layers and operational for operational layers to the index of each layer in the map. This allows you to easily access either the basemap or operational layers.
  var layers = response.itemInfo.itemData.operationalLayers;

Return value: dojo.Deferred
Input Parameters:
<String/Object> itemId/itemInfo Required An itemId for an ArcGIS.com item or the response object obtained from calling the esri.arcgis.utils.getItem method.
<String> mapDiv Required Container ID for referencing map.
<Object> options Optional

Optional parameters that define the map functionality:

<Object> mapOptions See the optional parameters for the esri.map constructor for more details.
<String> bingMapsKey The Bing Maps Key, required if working with Microsoft Bing Maps.
<String> geometryServiceURL URL to the ArcGIS Server REST resource that represents a geometry service. For more information on constructing a URL, see The Services Directory and the REST API.
Code snippets:
var deferred = esri.arcgis.utils.createMap(agoId, "map", {
  mapOptions: {
    slider: true
  },
  bingMapsKey: bingMapsKey,
  geometryServiceURL: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"
});

esri.arcgis.utils.getItem(itemId)

Get details about the input ArcGIS.com item. An object with the following specification is passed to the callback:

{
  item: <Object>,
  itemData: <Object>
}
Return value: dojo.Deferred
Input Parameters:
<String> itemId Required The itemId for the ArcGIS.com item.