require(["esri/arcgis/utils"], function(arcgisUtils) { /* code goes here */ });Description
(Added at v2.0)
Utility methods to work with content from ArcGIS.com.
When coding legacy (non-AMD) style, there is no need to require the module. All methods and properties are available in the namespace. For example, esri.arcgis.utils.createMap()
.
Search for
samplesthat use this class.
Properties arcgisUrlString
Specify the domain where the map associated with the webmap id is located. Methods
Property Details
Specify the domain where the map associated with the webmap id is located. The default value is https://www.arcgis.com/sharing/rest/content/items
Known values:
Default value: https://www.arcgis.com/sharing/rest/content/items
arcgisUtils.arcgisUrl = "https://mydomain/sharing/rest/content/items";
Method Details
Create a map using information from an ArcGIS.com item. The information included in the response object returned to the callback depends on the version.
Note:createMap
method projects the item's extent using a geometry service or by passing in an extent using options.mapOptions
. If using a geometry service, it will either create a new GeometryService using the options.geometryServiceURL
or it will use the GeometryService at esriConfig.defaults.geometryService
(if it exists).usePopupManager:true
if working with popups within the web map. One thing to note about this is that the clickEventHandle
and clickEventListener
will be undefined. Instead, use the Map.setInfoWindowOnClick
to control visibility of the popup.mode
is AUTO
. When working with smaller amounts of features, SNAPSHOT
mode is enabled. Whereas working with larger amounts of features enables on-demand
mode.{ map: <esri.Map>, clickEventHandle, <undefined> clickEventListener, <undefined> itemInfo:{ item: <Object>, itemData:<Object>, errors: [<Object>] } }
The returned object contains the following properties.
{ map: <esri.Map>, clickEventHandle, <Event Handler> clickEventListener, <Function> itemInfo:{ item: <Object>, itemData:<Object>, errors: [<Object>] } }
clickEventHandle
: handle to the map event connection registered by createMap
to display popups. Use this if you need to disconnect the handle at runtime.
require(["dojo/_base/connect", ... ], function(connect, ... ) { connect.disconnect(response.clickEventHandle); });
clickEventListener
: Use this function to reconnect the popup event handler.
map.on("click", function(response) { console.log(response.clickEventListener); });Parameters: <
String
| Object
> itemIdOrItemInfo Required An itemId for an ArcGIS.com item or the response object obtained from calling the arcgisUtils.getItem method. You can discover the item's unique ID by browsing to the item in ArcGIS.com then extracting the id from the item's URL. <String
> mapDiv Required Container ID for referencing map. <Object
> options Optional Optional parameters that define the map functionality. See the Object Specifications table below for the structure of the options
object. Object Specifications:
<options
>
String
> bingMapsKey Optional The Bing Maps key, required if working with Microsoft Bing Maps. <Boolean
> editable Optional Whether to allow layers in the created web map to be editable. If set to false, createMap() will create FeatureLayers where FeatureLayer.isEditable() returns false. This will override layers that would have otherwise been editable. This allows the FeatureLayer to load features optimally. Added at v3.11 <String
> geometryServiceURL Optional URL to the ArcGIS Server REST resource that represents a geometry service. If not using a geometry service from esriConfig.defaults.geometryService
, you will need to specify this if the basemap layer is not geographic or Web Mercator. For more information on constructing a URL, see the Services Directory and the REST API. <Boolean
> ignorePopups Optional When true, webmap define popups will not display. <Object[]
> layerMixins Optional An optional array of objects which identify the layer using either matching id
or url
properties. It also has a Object mixin
property that is mixed into the layer. Added at 3.14 <Object
> mapOptions Optional See the optional parameters for the esri.map constructor for more details. <Boolean
> usePopupManager Optional If true
and a map click event occurs, it may show the map's infoWindow. If the infoWindow supports showing more than one feature, it will search for all features in all layers of the map that have an infoTemplate configured, including the sublayers of a ArcGIS tiled or dynamic map service. When false
, disables the Map.showInfoWindowOnClick behavior. The default value is false
. (Added in version 3.10) See also: Map.setInfoWindowOnClick(enabled). Sample:
var map, bingMapsKey; require([ "esri/arcgis/utils", "esri/map", "dojo/domReady!" ], function (arcgisUtils, Map) { var deferred; var createMapOptions = { mapOptions: { slider: true }, usePopupManager: true, // since version 3.10 bingMapsKey: bingMapsKey, geometryServiceURL: "https://www.example.com/arcgis/rest/services/Geometry/GeometryServer" }; var webMapItemID = "c41d5f3b4e304806a047702fbfc2759e"; deferred = arcgisUtils.createMap(webMapItemID, "ui-map", createMapOptions); deferred.then(function (response) { map = response.map; }, function (error) { console.log("Error: ", error.code, " Message: ", error.message); deferred.cancel(); }); });
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4