Class ArcGISMap
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.ArcGISMap
-
- All Implemented Interfaces:
JsonSerializable
,Loadable
public final class ArcGISMap extends Object implements Loadable, JsonSerializable
An ArcGISMap contains layers of mapping data as well as other information which define the maps capabilities (e.g. basemaps, popups, renderers, labels etc...). A map can be visualized in a MapView and can also be used on its own to access the data.In an MVC architecture, an ArcGISMap represents the model and a MapView represents the view. An ArcGISMap specifies how the geographic data is organized, and a MapView renders the data on the screen and allows users to interact with it.
An ArcGISMap can contain a Basemap and or one or more operational layers:
- A Basemap is a map layer that helps orient the user of the map. Typically it sits behind operational layers and shows roads and parcel boundaries to give context to operational layers. Basemaps can also contain layers which are drawn over the top operational layers such as label layers.
- An operational layer provides content that is of unique interest to the app and the task at hand, such as data about earthquakes, traffic, or weather for example. Its content might change frequently.
An ArcGISMap can be manually created by adding layers or it can be instantiated from a map item, for example from a web map. When you create an ArcGISMap, the spatial reference of the first layer you add is used as the spatial reference of the entire map, which is typically the first layer in the Basemap. The code below shows how to create an ArcGISMap with a topographic basemap and add operational feature layer from a
ServiceFeatureTable
// add topographic basemap ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 10); // create the service feature table ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(URL); // create the feature layer using the service feature table FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable); // get the operational layers then add to operational layer to ArcGISMap LayerList operationalLayers = map.getOperationalLayers().add(featureLayer);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArcGISMap.BasemapChangedEvent
An event which indicates that the Basemap of the ArcGISMap has changed.static interface
ArcGISMap.BasemapChangedListener
The listener interface to get notified when the Basemap of the ArcGISMap changes.
-
Constructor Summary
Constructors Constructor Description ArcGISMap()
Creates an empty ArcGISMap instance.ArcGISMap(SpatialReference spatialReference)
Creates an ArcGISMap instance with a specified SpatialReference.ArcGISMap(Basemap basemap)
Creates an ArcGISMap instance which will contain just a basemap.ArcGISMap(Basemap.Type basemapType, double latitude, double longitude, int levelOfDetail)
Creates an ArcGISMap instance with a predefined basemap and an initial viewpoint.ArcGISMap(PortalItem portalItem)
Creates an ArcGISMap instance based on a PortalItem.ArcGISMap(String webMapUrl)
Creates an ArcGISMap instance from a web map URL.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBasemapChangedListener(ArcGISMap.BasemapChangedListener listener)
Adds a BasemapChangedListener to this ArcGISMap that gets invoked when the Basemap has changed.void
addDoneLoadingListener(Runnable listener)
Adds a listener to the loadable resource that is invoked when loading has completed.void
addLoadStatusChangedListener(LoadStatusChangedListener listener)
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
cancelLoad()
Cancels loading metadata for the object.ArcGISMap
copy()
Creates a copy of this ArcGISMap instance.static ArcGISMap
fromJson(String json)
Creates an ArcGISMap instance from a JSON string.Integer
getBackgroundColor()
Gets background color of the map.Basemap
getBasemap()
Gets the Basemap of this ArcGISMap.BookmarkList
getBookmarks()
Gets the mutable list of bookmarks of this ArcGISMap.Viewpoint
getInitialViewpoint()
Gets the initial viewpoint of the ArcGISMap.Item
getItem()
Gets the associated Item of this ArcGISMap.ArcGISRuntimeException
getLoadError()
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.LoadSettings
getLoadSettings()
Gets a load settings properties object that can be used to make changes to how feature layers loaded by this map are rendered.LoadStatus
getLoadStatus()
Returns theLoadStatus
of the loadable resource.double
getMaxScale()
Gets the maximum scale of the ArcGISMap.double
getMinScale()
Gets the minimum scale of the ArcGISMap.OfflineSettings
getOfflineSettings()
Gets the offline use settings, configured by the author of an online web map (if appropriate).LayerList
getOperationalLayers()
Gets the mutable list of operational layers of this ArcGISMap.double
getReferenceScale()
Gets the reference scale of the ArcGISMap.SpatialReference
getSpatialReference()
Gets the SpatialReference of this ArcGISMap.List<FeatureTable>
getTables()
Gets the tables in this ArcGISMap.List<TransportationNetworkDataset>
getTransportationNetworks()
Returns an unmodifiable list of transportation networks.Map<String,Object>
getUnknownJson()
If this object was created from JSON, this method gets unknown data from the source JSON.Map<String,Object>
getUnsupportedJson()
If this object was created from JSON, this method gets unsupported data from the source JSON.String
getVersion()
Gets the version of this ArcGISMap.void
loadAsync()
Loads the metadata of the loadable resource asynchronously.boolean
removeBasemapChangedListener(ArcGISMap.BasemapChangedListener listener)
Removes a BasemapChangedListener from this ArcGISMap.boolean
removeDoneLoadingListener(Runnable listener)
Removes a done loading listener from the loadable resource.boolean
removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Removes aLoadStatusChangedListener
from the loadable resource.void
retryLoadAsync()
Loads or retries loading metadata for the object asynchronously.ListenableFuture<PortalItem>
saveAsAsync(Portal portal, PortalFolder portalFolder, String title, Iterable<String> tags, String description, byte[] thumbnailData, boolean forceSaveToSupportedVersion)
Executes an asynchronous operation to save this map by creating a new map on the given portal in the given folder.ListenableFuture<PortalItem>
saveAsync(boolean forceSaveToSupportedVersion)
Executes an asynchronous operation to save any changes that have been made to the map.void
setBackgroundColor(Integer color)
Sets background color of the map.void
setBasemap(Basemap basemap)
Sets the Basemap of this ArcGISMap.void
setInitialViewpoint(Viewpoint viewpoint)
Sets the initial viewpoint of the ArcGISMap.void
setLoadSettings(LoadSettings loadSettings)
Sets the load settings for this map.void
setMaxScale(double maxScale)
Sets the maximum scale of the ArcGISMap.void
setMinScale(double minScale)
Sets the minimum scale of the ArcGISMap.void
setReferenceScale(double referenceScale)
Sets the reference scale of the ArcGISMap.String
toJson()
Serializes this ArcGISMap to a JSON string.
-
-
-
Constructor Detail
-
ArcGISMap
public ArcGISMap()
Creates an empty ArcGISMap instance. The map will need layers added to it before it can be used.- Since:
- 100.0.0
-
ArcGISMap
public ArcGISMap(Basemap basemap)
Creates an ArcGISMap instance which will contain just a basemap.- Parameters:
basemap
- the Basemap used with this ArcGISMap- Throws:
IllegalArgumentException
- if the basemap is null- Since:
- 100.0.0
- See Also:
Basemap
-
ArcGISMap
public ArcGISMap(Basemap.Type basemapType, double latitude, double longitude, int levelOfDetail)
Creates an ArcGISMap instance with a predefined basemap and an initial viewpoint.- Parameters:
basemapType
- the predefined basemap used with this ArcGISMaplatitude
- the latitude of the initial viewpoint which forms the center point of the maplongitude
- the longitude of the initial viewpoint which forms the center point of the maplevelOfDetail
- the level of detail that is converted to a scale for the initial Viewpoint. 0 is the most zoomed out level.- Throws:
IllegalArgumentException
- if the levelOfDetail is less than zero- Since:
- 100.0.0
- See Also:
Basemap.Type
-
ArcGISMap
public ArcGISMap(PortalItem portalItem)
Creates an ArcGISMap instance based on a PortalItem.If the portal item is not in
LoadStatus.LOADED
state it will be loaded automatically when this ArcGISMap instance is loaded.If the loaded portalItem is not of type
PortalItem.Type.WEBMAP
the map will fail to load.- Parameters:
portalItem
- the PortalItem associated with this ArcGISMap instance- Throws:
IllegalArgumentException
- if the portalItem is null- Since:
- 100.0.0
- See Also:
PortalItem
-
ArcGISMap
public ArcGISMap(SpatialReference spatialReference)
Creates an ArcGISMap instance with a specified SpatialReference. The map will not contain any layers.- Parameters:
spatialReference
- the SpatialReference used with this ArcGISMap- Since:
- 100.0.0
- See Also:
SpatialReference
-
ArcGISMap
public ArcGISMap(String webMapUrl)
Creates an ArcGISMap instance from a web map URL. Example URLs :http://www.arcgis.com/home/item.html?id=[web_map_id]
http://www.arcgis.com/home/webmap/viewer.html?webmap=[web_map_id]
http://www.arcgis.com/sharing/rest/content/items/[web_map_id]/data
http://www.arcgis.com/sharing/rest/content/items/[web_map_id]?f=pjson
- Parameters:
webMapUrl
- the URL of the web map on ArcGIS Online or an on-premises portal- Throws:
IllegalArgumentException
- if the URL is null or emptyIllegalArgumentException
- if the URL does not match the basic URL types- Since:
- 100.0.0
-
-
Method Detail
-
getLoadStatus
public LoadStatus getLoadStatus()
Description copied from interface:Loadable
Returns theLoadStatus
of the loadable resource.- Specified by:
getLoadStatus
in interfaceLoadable
- Returns:
- the LoadStatus of the loadable resource
-
getLoadError
public ArcGISRuntimeException getLoadError()
Description copied from interface:Loadable
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.If the resource subsequently transitions to
LoadStatus.LOADED
(for example, if a call toretryLoadAsync
completes successfully) the error is cleared out.- Specified by:
getLoadError
in interfaceLoadable
- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
LoadStatus.FAILED_TO_LOAD
state.
-
loadAsync
public void loadAsync()
Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)
that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED
, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOAD
and the error can be retrieved by callingLoadable.getLoadError()
.This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADING
state) whenloadAsync
is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
is called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsync
on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
.
-
retryLoadAsync
public void retryLoadAsync()
Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
-
cancelLoad
public void cancelLoad()
Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError()
.Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADING
state.- Specified by:
cancelLoad
in interfaceLoadable
-
addDoneLoadingListener
public void addDoneLoadingListener(Runnable listener)
Description copied from interface:Loadable
Adds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, use the
Loadable.addLoadStatusChangedListener(LoadStatusChangedListener)
method instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
public boolean removeDoneLoadingListener(Runnable listener)
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
public void addLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added
-
removeLoadStatusChangedListener
public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
-
getInitialViewpoint
public Viewpoint getInitialViewpoint()
Gets the initial viewpoint of the ArcGISMap.- Returns:
- the initial viewpoint, which determines the initial visible extent of this ArcGISMap when added to a MapView
- Since:
- 100.0.0
- See Also:
MapView
,Viewpoint
,setInitialViewpoint(com.esri.arcgisruntime.mapping.Viewpoint)
-
setInitialViewpoint
public void setInitialViewpoint(Viewpoint viewpoint)
Sets the initial viewpoint of the ArcGISMap.
-
getMinScale
public double getMinScale()
Gets the minimum scale of the ArcGISMap.- Returns:
- the minimum scale of the ArcGISMap; will be zero if the map is not loaded or there is no minimum scale and the user can zoom out indefinitely
- Since:
- 100.0.0
-
setMinScale
public void setMinScale(double minScale)
Sets the minimum scale of the ArcGISMap.- Parameters:
minScale
- the minimum scale to set; a value of zero indicates that there is no minimum scale and the user can zoom out indefinitely- Throws:
IllegalArgumentException
- if minScale is negative- Since:
- 100.0.0
-
getMaxScale
public double getMaxScale()
Gets the maximum scale of the ArcGISMap.- Returns:
- the maximum scale of the ArcGISMap; will be zero if the map is not loaded or there is no maximum scale and the user can zoom in indefinitely
- Since:
- 100.0.0
-
setMaxScale
public void setMaxScale(double maxScale)
Sets the maximum scale of the ArcGISMap.- Parameters:
maxScale
- the maximum scale to set; a value of zero indicates that there is no maximum scale and the user can zoom in indefinitely- Throws:
IllegalArgumentException
- if maxScale is negative- Since:
- 100.0.0
-
getReferenceScale
public double getReferenceScale()
Gets the reference scale of the ArcGISMap.The reference scale of the map is the scale at which a client should view the map for the feature symbols and text to appear at their authored size. If the client changes the viewing scale, then feature symbols and text will grow or shrink to keep a consistent size on the map (not the screen). This only happens if the reference scale is greater than zero and for feature layers that have
DrawingInfo.isScaleSymbols()
set to true, otherwise the symbols and text stay at their authored size. The reference scale will be zero if the map is not loaded or if there is no reference scale and the symbols and text should appear at default size regardless of the viewing scale.- Returns:
- the reference scale of the ArcGISMap; will be zero if the map is not loaded or there is no reference scale
- Since:
- 100.5.0
-
setReferenceScale
public void setReferenceScale(double referenceScale)
Sets the reference scale of the ArcGISMap.The reference scale of the map is the scale at which a client should view the map for the feature symbols and text to appear at their authored size. If the client changes the viewing scale, then feature symbols and text will grow or shrink to keep a consistent size on the map (not the screen). This only happens if the reference scale is greater than zero and for feature layers that have
DrawingInfo.isScaleSymbols()
set to true, otherwise the symbols and text stay at their authored size. The reference scale will be zero if the map is not loaded or if there is no reference scale and the symbols and text should appear at default size regardless of the viewing scale.This property is intended to be used for new ArcGISMap objects, that will have layers attached that expect a reference scale. Subsequent updates to the reference scale will cause a redraw of all layers that use the reference scale, and possible knock-on redraw of other layers that depend on them (for example dynamic labels that need to re-position to avoid overlaps).
- Parameters:
referenceScale
- the reference scale to set; a value of zero indicates that there is no reference scale- Throws:
IllegalArgumentException
- if referenceScale is negative- Since:
- 100.5.0
-
getItem
public Item getItem()
Gets the associated Item of this ArcGISMap.- Returns:
- the associated Item or null if this ArcGISMap is not associated with an Item
- Since:
- 100.0.0
-
getSpatialReference
public SpatialReference getSpatialReference()
Gets the SpatialReference of this ArcGISMap.- Returns:
- the SpatialReference of this ArcGISMap
- Since:
- 100.0.0
- See Also:
SpatialReference
-
getVersion
public String getVersion()
Gets the version of this ArcGISMap.- Returns:
- the version of this ArcGISMap
- Since:
- 100.0.0
-
copy
public ArcGISMap copy()
Creates a copy of this ArcGISMap instance.- Returns:
- a deep copy of this ArcGISMap instance, which means that copies of all fields of this map are made including its loading state.
- Since:
- 100.0.0
-
fromJson
public static ArcGISMap fromJson(String json)
Creates an ArcGISMap instance from a JSON string.- Parameters:
json
- the JSON representation of an ArcGISMap- Returns:
- an ArcGISMap instance deserialized from the JSON string
- Throws:
IllegalArgumentException
- if json is null or empty- Since:
- 100.0.0
-
toJson
public String toJson()
Serializes this ArcGISMap to a JSON string.- Specified by:
toJson
in interfaceJsonSerializable
- Returns:
- the JSON representation of this ArcGISMap
- Since:
- 100.0.0
-
getUnknownJson
public Map<String,Object> getUnknownJson()
Description copied from interface:JsonSerializable
If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.- Specified by:
getUnknownJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of
the values depend on the types of tokens within the JSON as follows:
- a
Map<String, Object>
represents an object in the JSON - a
List<Object>
represents an array in the JSON - a
String
represents a string in the JSON - a
Double
represents a number in the JSON - a
Boolean
represents true or false in the JSON null
represents null in the JSON
- a
-
getUnsupportedJson
public Map<String,Object> getUnsupportedJson()
Description copied from interface:JsonSerializable
If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.- Specified by:
getUnsupportedJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of
the values depend on the types of tokens within the JSON as follows:
- a
Map<String, Object>
represents an object in the JSON - a
List<Object>
represents an array in the JSON - a
String
represents a string in the JSON - a
Double
represents a number in the JSON - a
Boolean
represents true or false in the JSON null
represents null in the JSON
- a
-
getBasemap
public Basemap getBasemap()
Gets the Basemap of this ArcGISMap.- Returns:
- the Basemap of this ArcGISMap, which provides the geographical context
- Since:
- 100.0.0
- See Also:
Basemap
-
setBasemap
public void setBasemap(Basemap basemap)
Sets the Basemap of this ArcGISMap. The spatial reference of the Basemap will be used for all operational layers added when the Basemap is the first layer set on the ArcGISMap.- Parameters:
basemap
- the Basemap of this ArcGISMap, which provides the geographical context- Throws:
IllegalArgumentException
- if basemap is null- Since:
- 100.0.0
- See Also:
Basemap
-
getOperationalLayers
public LayerList getOperationalLayers()
Gets the mutable list of operational layers of this ArcGISMap.Operational layers are drawn between the base and reference layers of a Basemap.
You can be notified about changes to the LayerList by adding a callback listener with
LayerList.addListChangedListener(com.esri.arcgisruntime.util.ListChangedListener<com.esri.arcgisruntime.layers.Layer>)
.
-
getBookmarks
public BookmarkList getBookmarks()
Gets the mutable list of bookmarks of this ArcGISMap.You can get notified about changes to the BookmarkList by adding a callback listener with
BookmarkList.addListChangedListener(com.esri.arcgisruntime.util.ListChangedListener<com.esri.arcgisruntime.mapping.Bookmark>)
.- Returns:
- the BookmarkList that contains the bookmarks of this ArcGISMap; may return an empty list but never null
- Since:
- 100.0.0
- See Also:
BookmarkList
,Bookmark
-
addBasemapChangedListener
public void addBasemapChangedListener(ArcGISMap.BasemapChangedListener listener)
Adds a BasemapChangedListener to this ArcGISMap that gets invoked when the Basemap has changed.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- Parameters:
listener
- a BasemapChangedListener that gets invoked when the Basemap has changed- Throws:
IllegalArgumentException
- if the listener is null- Since:
- 100.0.0
-
removeBasemapChangedListener
public boolean removeBasemapChangedListener(ArcGISMap.BasemapChangedListener listener)
Removes a BasemapChangedListener from this ArcGISMap.- Parameters:
listener
- the BasemapChangedListener to remove- Returns:
- true if the BasemapChangedListener has been removed, otherwise false
- Throws:
IllegalArgumentException
- if the listener is null- Since:
- 100.0.0
-
saveAsync
public ListenableFuture<PortalItem> saveAsync(boolean forceSaveToSupportedVersion)
Executes an asynchronous operation to save any changes that have been made to the map. The map must be associated with aPortalItem
object, and must be loaded. The result is a reference to the map's PortalItem object.Saving an existing webmap will keep the portal item extent in sync with the initial viewpoint of the map set using the
setInitialViewpoint(Viewpoint)
method.Updates the map content data on the portal and also updates the portal item properties stored on the portal to match those stored within the map's PortalItem object.
When saving a webmap it is always saved as the currently supported webmap version of the API (see system requirements). This may cause data loss as
JsonSerializable.getUnknownJson()
, unknown objects (e.g.UnknownLayer
s) and other properties unknown to the webmap specification (e.g. new layer types or local data paths) are not saved.JsonSerializable.getUnsupportedJson()
is maintained and saved in the map as it is known to the webmap specification but not explicitly exposed by this API. This operation includes the forceSaveToSupportedVersion flag which can be used to provide a warning to users that some map data may be lost when the map is saved.- Parameters:
forceSaveToSupportedVersion
- flag to indicate whether the map should be saved to the supported webmap version that the API supports (see system requirements). This may cause data loss as unknown data is not saved. If true, unknown data will be removed and the map will be saved. If false, the asynchronous operation will fail if the map contains unknown data that will not be saved. This flag can be used to provide a warning to users that some map data may be lost when the map is saved.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request failsIllegalStateException
if the map contains unknown data and forceSaveToSupportedVersion is false
- Throws:
IllegalStateException
- if the map is not loaded or is not associated with a PortalItem objectArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to save maps to a portal)- Since:
- 100.0.0
-
saveAsAsync
public ListenableFuture<PortalItem> saveAsAsync(Portal portal, PortalFolder portalFolder, String title, Iterable<String> tags, String description, byte[] thumbnailData, boolean forceSaveToSupportedVersion)
Executes an asynchronous operation to save this map by creating a new map on the given portal in the given folder. Once completed, the map will be associated with a new PortalItem object. The new item will belong to the user currently signed in to the portal and its access level will bePortalItem.Access.PRIVATE
.Note that if the map was already associated with a PortalItem object (either because the map was created using a PortalItem or was previously saved), that object will be replaced with a new PortalItem, effectively 'duplicating' the map on the portal.
When saving a webmap it is always saved as the currently supported webmap version of the API (see system requirements). This may cause data loss as
JsonSerializable.getUnknownJson()
, unknown objects (e.g.UnknownLayer
s) and other properties unknown to the webmap specification (e.g. new layer types or local data paths) are not saved.JsonSerializable.getUnsupportedJson()
is maintained and saved in the map as it is known to the webmap specification but not explicitly exposed by this API. This operation includes the forceSaveToSupportedVersion flag which can be used to provide a warning to users that some map data may be lost when the map is saved.The result is a reference to the map's PortalItem object.
Saving a map does not automatically include the extent of the current MapView. If you want to save the current extent with the map, then get the
GeoView.getCurrentViewpoint(Viewpoint.Type)
and pass it to thesetInitialViewpoint(Viewpoint)
method to ensure the current extent is saved with the map. For example:Viewpoint vp = mapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY); map.setInitialViewpoint(vp);
- Parameters:
portal
- the portal on which to save the map; must not be null and must not be loaded anonymously; to ensure it's not loaded anonymously, either set a credential on it usingPortal.setCredential(Credential)
before the portal is loaded, or use thePortal(String, boolean)
constructor with loginRequired set to trueportalFolder
- a PortalFolder belonging to the current user in which to save the map, or null to save it in the user's root foldertitle
- a title for the map; must not be null or emptytags
- a list of tags to associate with the map, or null if nonedescription
- a description for the map, or null if nonethumbnailData
- thumbnail data for the map, or null if noneforceSaveToSupportedVersion
- flag to indicate whether the map should be saved to the supported webmap version that the API supports (see system requirements). This may cause data loss as unknown data is not saved. If true, unknown data will be removed and the map will be saved. If false, the asynchronous operation will fail if the map contains unknown data that will not be saved. This flag can be used to provide a warning to users that some map data may be lost when the map is saved.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request failsIllegalStateException
if the map contains unknown data and forceSaveToSupportedVersion is falseIllegalStateException
if the portal is loaded anonymously
- Throws:
IllegalArgumentException
- if portal or title is null, or title is an empty stringIllegalStateException
- if the map is not loadedArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to save maps to a portal)- Since:
- 100.0.0
-
getTransportationNetworks
public List<TransportationNetworkDataset> getTransportationNetworks()
Returns an unmodifiable list of transportation networks.- Returns:
- a list of
TransportationNetworkDataset
- Since:
- 100.0.0
-
getTables
public List<FeatureTable> getTables()
Gets the tables in this ArcGISMap. The list is modifiable, that is, tables can be added and removed. Tables are not loaded by default. Tables are loaded internally when asynchronous operations like query are performed. Alternatively, they can be loaded by callingFeatureTable.loadAsync()
.- Returns:
- a modifiable list of tables
- Since:
- 100.1.0
-
getLoadSettings
public LoadSettings getLoadSettings()
Gets a load settings properties object that can be used to make changes to how feature layers loaded by this map are rendered.- Returns:
- the load settings
- Since:
- 100.2.0
- See Also:
LoadSettings
-
setLoadSettings
public void setLoadSettings(LoadSettings loadSettings)
Sets the load settings for this map. The load settings change how feature layers loaded by this map are rendered.- Parameters:
loadSettings
- the load settings- Throws:
IllegalArgumentException
- if loadSettings is null- Since:
- 100.2.0
- See Also:
LoadSettings
-
getOfflineSettings
public OfflineSettings getOfflineSettings()
Gets the offline use settings, configured by the author of an online web map (if appropriate).These settings will only be populated when this map represents an online web map and the author has chosen to set them. The properties can be used to inform how a map should be taken offline. If no offline settings were provided, or if this map does not represent an online web map, this property will be null.
- Returns:
- the offline settings or null if the property is not set or the map is not a web map
- Since:
- 100.5.0
- See Also:
OfflineSettings
-
setBackgroundColor
public void setBackgroundColor(Integer color)
Sets background color of the map.The value determines the color to be displayed behind the map. This color will be displayed in transparent areas of the map as well as areas where there is no basemap or operational data.
When a map is set on a
MapView
, changes to the background color will immediately take effect.The default value is null. In this case, the
MapView.getBackgroundGrid()
is used to determine the background color to display.- Parameters:
color
- an Integer representing the color as 0xAARRGGBB, or null for no background color- Since:
- 100.7.0
-
getBackgroundColor
public Integer getBackgroundColor()
Gets background color of the map.The value determines the color to be displayed behind the map. This color will be displayed in transparent areas of the map as well as areas where there is no basemap or operational data.
When a map is set on a
MapView
, changes to the background color will immediately take effect.The default value is null. In this case, the
MapView.getBackgroundGrid()
is used to determine the background color to display.- Returns:
- an Integer representing the color as 0xAARRGGBB, or null if no background color is set
- Since:
- 100.7.0
-
-