Class ArcGISTiledLayer
- java.lang.Object
-
- com.esri.arcgisruntime.layers.Layer
-
- com.esri.arcgisruntime.layers.ImageAdjustmentLayer
-
- com.esri.arcgisruntime.layers.ImageTiledLayer
-
- com.esri.arcgisruntime.layers.ArcGISTiledLayer
-
- All Implemented Interfaces:
ApiKeyResource
,RemoteResource
,LayerContent
,Loadable
public final class ArcGISTiledLayer extends ImageTiledLayer implements RemoteResource, ApiKeyResource
Displays data from a ArcGIS Map service using pre-generated tiles.ArcGIS tiled layers consume image tiles provided by an ArcGIS map service or a tile package. Raster tiles are cached by the server at various scales instead of dynamically generating map images at the request of the client application. The client requests the tiles needed at a particular map extent. You can use the
ExportTileCacheTask
class to generate and download tiles from the service, creating a tile package (.tpk/.tpkx) for use locally on the device. Alternatively, you can use ArcGIS Pro to create a map tile package and provision it to the device. You can tell if an ArcGIS map server is hosting a compatibleArcGISTiledLayer
when "Single Fused Map Cache" is true in the ArcGIS REST Services Directory.Functional characteristics
ArcGIS tiled layers do not support re-projection, query, select, identify, or editing.
Performance characteristics
Tiled image layers (those that derive functionality from the
ImageTiledLayer
class) provide fast display of geographic imagery stored in raster files. These rasters typically contain image data acquired from satellite, aircraft, or drones. The resolution of such imagery can be very high, providing a detailed view. With increased resolution comes increased file sizes and potentially slower performance.Raster tiling is a process that resamples the pixel size at different scales to create images with the appropriate resolution for each scale. The tiling process creates level-of-detail pyramids to efficiently manage how much detail you see as you zoom in and out on the map. Typically, as you zoom closer to the Earth's surface, you want to see greater detail of the geographic information. Tiled image layers allow you to see just the information you need very quickly based on the level-of-detail pyramid at a particular scale, rather than having to load a single large image at once.
Tiles are generated by the server when the service is created. Requests for tiles are made on multiple threads and handled asynchronously. The size of each returned tile increases as the resolution or complexity of the image in the tile increases. For example, high-resolution imagery tiles can be result in larger file sizes than topographic mapping for the same area and map extent.
- Since:
- 100.0.0
- See Also:
Layer
,ImageTiledLayer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esri.arcgisruntime.layers.ImageTiledLayer
ImageTiledLayer.BufferSize, ImageTiledLayer.NoDataTileBehavior
-
-
Constructor Summary
Constructors Constructor Description ArcGISTiledLayer(TileCache tileCache)
Creates a new ArcGIS tiled layer from a tile cache.ArcGISTiledLayer(PortalItem portalItem)
Creates a new ArcGISTiledLayer based on a map service PortalItem.ArcGISTiledLayer(String url)
Creates a new ArcGIS tiled layer from a map service or map service portal item at the given URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArcGISTiledLayer
copy()
Creates a deep copy of this ArcGISTiledLayer instance.String
getApiKey()
Gets the API key to access API key enabled services and resources in ArcGIS Online.Credential
getCredential()
Gets the credential used to authenticate the user with the tiled layer.ArcGISMapServiceInfo
getMapServiceInfo()
Gets the map service information for this layer.long
getRefreshInterval()
Gets the refresh interval in milliseconds.RequestConfiguration
getRequestConfiguration()
Gets the RequestConfiguration object in use by this Layer.ListenableList<ArcGISSublayer>
getSublayers()
Gets the sublayers for this layer.protected byte[]
getTile(TileKey tileKey)
Gets the encoded bytes that represents a tile for the given tile key.TileCache
getTileCache()
Gets the tile cache of this tiled layer if it references a tile cache (offline layer).String
getUri()
Gets the URL of the tiled layer.void
setApiKey(String apiKey)
Sets the API key to access API key enabled services and resources in ArcGIS Online.void
setCredential(Credential credential)
Sets the credential used to authenticate the user with the tiled layer.void
setRefreshInterval(long refreshIntervalMilliseconds)
Sets the refresh interval in milliseconds.void
setRequestConfiguration(RequestConfiguration requestConfiguration)
Sets configuration parameters used for network requests sent using this Layer object.-
Methods inherited from class com.esri.arcgisruntime.layers.ImageTiledLayer
getBufferSize, getNoDataTileBehavior, getTileInfo, setBufferSize, setNoDataTileBehavior
-
Methods inherited from class com.esri.arcgisruntime.layers.ImageAdjustmentLayer
getBrightness, getContrast, getGamma, setBrightness, setContrast, setGamma
-
Methods inherited from class com.esri.arcgisruntime.layers.Layer
addDoneLoadingListener, addLoadStatusChangedListener, addVisibilityChangedListener, cancelLoad, canChangeVisibility, canShowInLegend, fetchLegendInfosAsync, getAttribution, getDescription, getFullExtent, getId, getItem, getLoadError, getLoadStatus, getMaxScale, getMinScale, getName, getOpacity, getSpatialReference, getSubLayerContents, isIdentifyEnabled, isVisible, isVisibleAtScale, loadAsync, removeDoneLoadingListener, removeLoadStatusChangedListener, removeVisibilityChangedListener, retryLoadAsync, setCanShowInLegend, setDescription, setId, setMaxScale, setMinScale, setName, setOpacity, setVisible
-
-
-
-
Constructor Detail
-
ArcGISTiledLayer
public ArcGISTiledLayer(PortalItem portalItem)
Creates a new ArcGISTiledLayer based on a map service PortalItem.If the portal item argument is not in
LoadStatus#LOADED
state it will be loaded automatically when this ArcGISTiledLayer instance is loaded.- Parameters:
portalItem
- a map service PortalItem- Throws:
IllegalArgumentException
- if portalItem is null- Since:
- 100.0.0
-
ArcGISTiledLayer
public ArcGISTiledLayer(String url)
Creates a new ArcGIS tiled layer from a map service or map service portal item at the given URL.To use a credential, call
setCredential(Credential)
after this constructor and before loading or using this layer.If the specified URI is a portal item URL (see
PortalItem
for the supported URL formats), the underlyingPortalItem
will be created and accessible throughLayer.getItem()
.- Parameters:
url
- the map service or portal item URL- Throws:
IllegalArgumentException
- if the URL is null or empty- Since:
- 100.0.0
- See Also:
PortalItem
,PortalItem(Portal, String)
-
ArcGISTiledLayer
public ArcGISTiledLayer(TileCache tileCache)
Creates a new ArcGIS tiled layer from a tile cache.The supported file formats:
- Tiled Package .tpk, which holds data about tiles (images) from an ArcGISMap wrapped in a single file.
- Exploded Cache, where each tile is stored in a single file.
- Compact Cache, where groups of tiles are stored together in large files called bundles.
Can be used to work with tiled layers offline.
- Parameters:
tileCache
- the tile cache to use- Throws:
IllegalArgumentException
- if argument is null- Since:
- 100.0.0
-
-
Method Detail
-
copy
public ArcGISTiledLayer copy()
Creates a deep copy of this ArcGISTiledLayer instance.- Returns:
- a deep copy of this ArcGISTiledLayer instance, which means that copies of all fields of this layer are made including its loading state
- Since:
- 100.1.0
-
getTileCache
public TileCache getTileCache()
Gets the tile cache of this tiled layer if it references a tile cache (offline layer).- Returns:
- the tile cache of this tiled layer or null if this layer references an online service
- Since:
- 100.9.0
- See Also:
ArcGISTiledLayer(TileCache)
-
getRefreshInterval
public long getRefreshInterval()
Gets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.- Returns:
- the refresh interval in milliseconds
- Since:
- 100.1.0
-
setRefreshInterval
public void setRefreshInterval(long refreshIntervalMilliseconds)
Sets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.- Parameters:
refreshIntervalMilliseconds
- the refresh interval in milliseconds- Throws:
IllegalArgumentException
- if milliseconds is less than zero- Since:
- 100.1.0
-
setCredential
public void setCredential(Credential credential)
Sets the credential used to authenticate the user with the tiled layer.- Specified by:
setCredential
in interfaceRemoteResource
- Parameters:
credential
- the credential used to authenticate the user with the tiled layer- Since:
- 100.0.0
-
getCredential
public Credential getCredential()
Gets the credential used to authenticate the user with the tiled layer.- Specified by:
getCredential
in interfaceRemoteResource
- Returns:
- the credential used to authenticate the user with the tiled layer
- Since:
- 100.0.0
-
setRequestConfiguration
public void setRequestConfiguration(RequestConfiguration requestConfiguration)
Sets configuration parameters used for network requests sent using this Layer object. The global RequestConfiguration is used if no RequestConfiguration is set.- Specified by:
setRequestConfiguration
in interfaceRemoteResource
- Parameters:
requestConfiguration
- object containing the parameters to use- Since:
- 100.0.0
-
getRequestConfiguration
public RequestConfiguration getRequestConfiguration()
Gets the RequestConfiguration object in use by this Layer.- Specified by:
getRequestConfiguration
in interfaceRemoteResource
- Returns:
- the RequestConfiguration object or null if none has been set
- Since:
- 100.0.0
- See Also:
RequestConfiguration
-
getUri
public String getUri()
Gets the URL of the tiled layer.- Specified by:
getUri
in interfaceRemoteResource
- Returns:
- the URL of the tiled layer
- Since:
- 100.0.0
-
getMapServiceInfo
public ArcGISMapServiceInfo getMapServiceInfo()
Gets the map service information for this layer.- Returns:
- map service information for this layer
- Since:
- 100.0.0
-
getSublayers
public ListenableList<ArcGISSublayer> getSublayers()
Gets the sublayers for this layer.- Returns:
- an unmodifiable list of ArcGISSublayers
- Since:
- 100.2.0
-
getApiKey
public String getApiKey()
Description copied from interface:ApiKeyResource
Gets the API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.
In addition to setting an API key at a global level for your application using
ArcGISRuntimeEnvironment.setApiKey(String)
, you can callApiKeyResource.setApiKey(String)
on any ArcGIS Runtime class that implementsApiKeyResource
. When you callsetApiKey(String)
on anAPIKeyResource
, it will override the default key at the global level (the key returned byArcGISRuntimeEnvironment.getApiKey()
, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.Classes that expose an API key property by implementing APIKeyResource include:
- Specified by:
getApiKey
in interfaceApiKeyResource
- Returns:
- the API key to access API key enabled services and resources in ArcGIS Online
- See Also:
ApiKeyResource.setApiKey(String)
-
setApiKey
public void setApiKey(String apiKey)
Description copied from interface:ApiKeyResource
Sets the API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.
In addition to setting an API key at a global level for your application using
ArcGISRuntimeEnvironment.setApiKey(String)
, you can callsetApiKey(String)
on any ArcGIS Runtime class that implementsApiKeyResource
. When you callsetApiKey(String)
on anAPIKeyResource
, it will override the default key at the global level (the key returned byArcGISRuntimeEnvironment.getApiKey()
, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.Classes that expose an API key property by implementing APIKeyResource include:
- Specified by:
setApiKey
in interfaceApiKeyResource
- Parameters:
apiKey
- the API key to access API key enabled services and resources in ArcGIS Online- See Also:
ApiKeyResource.getApiKey()
-
getTile
protected byte[] getTile(TileKey tileKey)
Description copied from class:ImageTiledLayer
Gets the encoded bytes that represents a tile for the given tile key. The encoding must matchTileInfo
specified in the constructorImageTiledLayer(TileInfo, Envelope)
.- Specified by:
getTile
in classImageTiledLayer
- Parameters:
tileKey
- key for the expected tile- Returns:
- the encoded bytes that represent the tile for the given tile key
-
-