public class

WebMap

extends Object
java.lang.Object
   ↳ com.esri.core.portal.WebMap

Class Overview

This class represents a WebMap and provides access to the base layers and operational layers within a WebMap.

Summary

Protected Constructors
WebMap(JsonParser parser, PortalItem item)
Constructs an empty WebMap.
WebMap(PortalItem item)
Constructs an empty WebMap.
WebMap(PortalItem item, boolean innerWebmap)
Constructs an empty WebMap.
Public Methods
String getApplicationPropertiesJson()
Returns the JSON string representing the application properties defined in the web map.
BaseMap getBaseMap()
Returns the BaseMap of this WebMap.
List<Bookmark> getBookmarks()
Returns a list of bookmarks defined for this WebMap.
UserCredentials getCredentials()
Returns the user credentials used on this webmap object.
PortalItem getInfo()
Returns the PortalItem that describes this WebMap.
Envelope getInitExtent()
Gets the initial extent of the web map.
List<WebMapLayer> getOperationalLayers()
Returns the operational layers of this WebMap.
List<WebMapQuery> getPredefinedQueries()
Returns a list of predefined queries that were authored with this WebMap.
String getVersion()
Returns the version of this WebMap.
static WebMap newInstance(JsonParser parser, Envelope extent, SpatialReference sr)
Creates and returns a WebMap instance using JSON data and an extent.
static WebMap newInstance(PortalItem portalitem)
Creates and returns a WebMap instance using a PortalItem.
static void newInstance(String itemId, Portal portal, CallbackListener<WebMap> callbackListener)
Asynchronously creates a WebMap instance using a web map's Portal and item ID; the initialized WebMap gets returned in the callback.
static void newInstance(URL itemIdURL, String username, String password, CallbackListener<WebMap> callbackListener)
Asynchronously creates a WebMap instance from the URL to a Portal item representing a web map; the initialized WebMap gets returned in the callback.
static WebMap newInstance(String itemId, Portal portal)
Creates and returns a WebMap instance using a web map's Portal and item ID.
static void newInstance(URL itemIdURL, UserCredentials credentials, CallbackListener<WebMap> callbackListener)
Asynchronously creates a WebMap instance from the URL to a Portal item representing a web map; the initialized WebMap gets returned in the callback.
static WebMap newInstance(BaseMap basemap, Envelope extent, SpatialReference sr)
Creates and returns a WebMap instance using a BaseMap and an extent.
Protected Methods
static WebMap newInstance(String itemId, Portal portal, boolean innerWebmap)
This is intended to be used to parse the "layers" section of a portal item representing a service layer.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected WebMap (JsonParser parser, PortalItem item)

Constructs an empty WebMap. Users will never programmatically create a new instance of a WebMap.

Parameters
parser JsonParser
item PortalItem
Throws
Exception

protected WebMap (PortalItem item)

Constructs an empty WebMap. Users will never programmatically create a new instance of a WebMap.

Parameters
item PortalItem
Throws
Exception

protected WebMap (PortalItem item, boolean innerWebmap)

Constructs an empty WebMap. Users will never programmatically create a new instance of a WebMap. This version is intended to be used to parse the "layers" section of another webmap. To do this, set innerWebmap to true.

Parameters
item PortalItem
innerWebmap boolean
Throws
Exception

Public Methods

public String getApplicationPropertiesJson ()

Returns the JSON string representing the application properties defined in the web map.

Returns
String a JSON string, or null if there are no application properties

public BaseMap getBaseMap ()

Returns the BaseMap of this WebMap.

Returns
BaseMap the BaseMap

public List<Bookmark> getBookmarks ()

Returns a list of bookmarks defined for this WebMap.

Returns
List<Bookmark> list of Bookmarks, or null if there are none

public UserCredentials getCredentials ()

Returns the user credentials used on this webmap object.

Returns
UserCredentials user credentials, or null if not available

public PortalItem getInfo ()

Returns the PortalItem that describes this WebMap.

Returns
PortalItem the PortalItem that describes this WebMap

public Envelope getInitExtent ()

Gets the initial extent of the web map.

Returns
Envelope initial extent in EPSG:4326, or null if not available

public List<WebMapLayer> getOperationalLayers ()

Returns the operational layers of this WebMap.

Returns
List<WebMapLayer> list of WebMapLayers, or null if there are none

public List<WebMapQuery> getPredefinedQueries ()

Returns a list of predefined queries that were authored with this WebMap.

Returns
List<WebMapQuery> list of WebMapQuery, or null if there are none

public String getVersion ()

Returns the version of this WebMap.

Returns
String version of this WebMap

public static WebMap newInstance (JsonParser parser, Envelope extent, SpatialReference sr)

Creates and returns a WebMap instance using JSON data and an extent. Be cautious when using this method to create a WebMap, as there isn't a PortalItem backing it.

Parameters
parser JsonParser: contains the JSON data
extent Envelope: the extent
sr SpatialReference: spatial reference of the extent
Returns
WebMap a WebMap instance
Throws
Exception the exception

public static WebMap newInstance (PortalItem portalitem)

Creates and returns a WebMap instance using a PortalItem.

Parameters
portalitem PortalItem: PortalItem specifying a web map on a portal
Returns
WebMap a WebMap instance
Throws
Exception any exception on creating the WebMap

public static void newInstance (String itemId, Portal portal, CallbackListener<WebMap> callbackListener)

Asynchronously creates a WebMap instance using a web map's Portal and item ID; the initialized WebMap gets returned in the callback. This constructor is useful for applications that prefer persisting the item ID of an item previously obtained from a Portal and then using the ID to retrieve the associated item data.

Parameters
itemId String: item ID of a web map
portal Portal: Portal instance for the item ID specified
callbackListener CallbackListener: callback returning an initialized WebMap instance, or error details on error

public static void newInstance (URL itemIdURL, String username, String password, CallbackListener<WebMap> callbackListener)

Asynchronously creates a WebMap instance from the URL to a Portal item representing a web map; the initialized WebMap gets returned in the callback. A username and password will be required if the requested web map is accessible only to authorized users. If a token is supplied with the URL, then the username and password are ignored.

Parameters
itemIdURL URL: URL to a Portal item, for example http://www.arcgis.com/home/item.html?id=df51edbfb9474fe6ab2f0852fe6caa26
username String: the username to access the Portal item
password String: the password to access the Portal item
callbackListener CallbackListener: callback returning an initialized WebMap instance, or error details on error

public static WebMap newInstance (String itemId, Portal portal)

Creates and returns a WebMap instance using a web map's Portal and item ID. This constructor is useful for applications that prefer persisting the item ID of an item previously obtained from a Portal and then using the ID to retrieve the associated item data. Performs a network request on the current thread, so do not call this from the UI thread.

Parameters
itemId String: item ID of a web map
portal Portal: Portal instance for the item ID specified
Returns
WebMap a WebMap instance
Throws
Exception any exception on creating the WebMap

public static void newInstance (URL itemIdURL, UserCredentials credentials, CallbackListener<WebMap> callbackListener)

Asynchronously creates a WebMap instance from the URL to a Portal item representing a web map; the initialized WebMap gets returned in the callback. User credentials will be required if the requested WebMap is accessible only to authorized users. If a token is supplied with the URL, then the credentials are ignored.

Parameters
itemIdURL URL: URL to a Portal item, for example http://www.arcgis.com/home/item.html?id=df51edbfb9474fe6ab2f0852fe6caa26
credentials UserCredentials: the credentials to access the Portal item specified by the URL
callbackListener CallbackListener: callback returning an initialized WebMap instance, or error details on error

public static WebMap newInstance (BaseMap basemap, Envelope extent, SpatialReference sr)

Creates and returns a WebMap instance using a BaseMap and an extent. Be cautious when using this method to create a WebMap, as there isn't a PortalItem backing it.

Parameters
basemap BaseMap: BaseMap for the WebMap
extent Envelope: full extent for the WebMap
sr SpatialReference: spatial reference of the map extent
Returns
WebMap a WebMap instance

Protected Methods

protected static WebMap newInstance (String itemId, Portal portal, boolean innerWebmap)

This is intended to be used to parse the "layers" section of a portal item representing a service layer.

Parameters
itemId String: id of portal item containing layers
portal Portal: portal item belongs to
innerWebmap boolean: set true to parse layers section only. This turns off type checking that throws an exception if we attempt to parse a non-webmap portal item with this class
Returns
WebMap WebMap instance containing WebMapSubLayers.
Throws
Exception