- All Implemented Interfaces:
RemoteResource
,LayerContent
,Loadable
- Direct Known Subclasses:
OpenStreetMapLayer
This layer provides a simple way to integrate non-ArcGIS Services as a layer in a map. The URL template usually follows a
pattern similar to https://{subDomain}.server.org/path/{level}/{col}/{row}.png
, where:
subDomain
is one of the strings in the subDomains listlevel
corresponds to a zoom levelcol
represents the column of the tilerow
represents the row of the tile.
https://
) or to a local file cache (%file://
}).
The tiles retrieved by this class are accessed directly by URL. Because the service is only providing images, you are responsible for manually setting the attribution text on the map or scene view.
To create a custom service tiled layer whose URL follows the above pattern (or a similar pattern), you can extend
this class. Alternatively, you can extend the super class ServiceImageTiledLayer
, in which you implement
a required method to set the request information for a given Level of Detail (LOD) , column, and row.
Extending WebTiledLayer
, however, has no such requirement.
An exception will be thrown when attempting to load a layer with invalid URI template.
If TileInfo
is not specified, tiles are assumed to be in the OpenStreetMap tiling scheme, with 256x256 PNG
tiles at 96 DPI, the WebMercator projection, and a FullExtent of [-180, -85.0511, 180, 85.051].
Functional characteristics
Specifying sub-domains from which the layer will request tiles allows the load to be more evenly distributed among servers.
Performance characteristics
Web tiled layer requires a connection to the service at all times. Performance is similar to other raster tile layers.
Example for working with a WebTiledLayer
WebTiledLayer webTiledLayer = new WebTiledLayer( "http://{subDomain}.tile.opencyclemap.org/cycle/{level}/{col}/{row}.png", // templateUri Arrays.asList("a", "b") // subDomains ); webTiledLayer.addDoneLoadingListener(new Runnable() { public void run() { if (webTiledLayer.getLoadStatus() == LoadStatus.LOADED) { // work with the layer here } } }); map.getOperationalLayers().add(webTiledLayer); mapView.setMap(map);The layer is loaded when displayed in a
MapView
or SceneView
if using the layer without a
MapView
or SceneView
, call the Layer.loadAsync()
method. Use the layer done loading event
to determine when the layer is ready, and check the load status before using the layer.- Since:
- 100.1.0
- See Also:
-
Property Summary
Properties inherited from class com.esri.arcgisruntime.layers.Layer
loadError, loadStatus
-
Nested Class Summary
Nested classes/interfaces inherited from class com.esri.arcgisruntime.layers.ImageTiledLayer
ImageTiledLayer.BufferSize, ImageTiledLayer.NoDataTileBehavior
-
Constructor Summary
ConstructorDescriptionWebTiledLayer
(String templateUri) Creates a web tiled layer with the given URI template.WebTiledLayer
(String templateUri, TileInfo tileInfo, Envelope fullExtent) Creates a web tiled layer with the specified URI template, tiling scheme information, and extent.WebTiledLayer
(String templateUri, Iterable<String> subDomains) Creates a web tiled layer with the given URI template and collection of sub-domains.WebTiledLayer
(String templateUri, Iterable<String> subDomains, TileInfo tileInfo, Envelope fullExtent) Creates a web tiled layer with the given URI template, sub-domain collection, tiling scheme information, and extent. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a deep copy of this WebTiledLayer instance.Gets the collection of sub-domains that can be used for the "{subDomain}" key in thegetTemplateUri()
.The URI template for this web tiled layer.protected String
getTileUrl
(TileKey tileKey) Gets the url to be used to request a tile given the tile key.getUri()
Gets a null URI String indicating no specific endpoint URI associated with this WebTiledLayer.void
setAttribution
(String attribution) Sets the attribution.Methods inherited from class com.esri.arcgisruntime.layers.ServiceImageTiledLayer
copyTo, getCredential, getRequestConfiguration, getTile, setCredential, setRequestConfiguration
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, loadErrorProperty, loadStatusProperty, removeDoneLoadingListener, removeLoadStatusChangedListener, removeVisibilityChangedListener, retryLoadAsync, setCanShowInLegend, setDescription, setId, setMaxScale, setMinScale, setName, setOpacity, setVisible
-
Constructor Details
-
WebTiledLayer
Creates a web tiled layer with the given URI template.Use this constructor to create a WebTiledLayer to integrate non-ArcGIS Services as a layer in a map. Since this constructor does not require an explicit
TileInfo
argument, the max LOD will be 23 (approximate scale of 70 and resolution of 1.86 cm/pixel). The URI template usually follows a pattern similar to https://server.org/path/{level}/{col}/{row}.png, where:- "level" corresponds to a zoom level.
- "col" represents the column of the tile.
- "row" represents the row of the tile.
The URI should be arranged to reflect how the tiles are arranged in the cache or on the server, and can point to a web server (https://) or to a local file cache (file://).
The tiles are assumed to be in the OpenStreetMap tiling scheme, with 256x256 PNG tiles at 96 DPI, the webMercator projection, and an extent of [-180, -85.0511, 180, 85.051].
TileInfo
andLayer.getFullExtent()
are set to OpenStreetMap-compatible defaults, andgetSubDomains()
is left empty.- Parameters:
templateUri
- a template Uri for tile requests- Throws:
IllegalArgumentException
- if templateUri is null or empty- Since:
- 100.1.0
-
WebTiledLayer
Creates a web tiled layer with the given URI template and collection of sub-domains.Use this constructor to create a WebTiledLayer to integrate non-ArcGIS Services as a layer in a map. Since this constructor does not require an explicit
TileInfo
argument, the max LOD will be 23 (approximate scale of 70 and resolution of 1.86 cm/pixel). The URI template usually follows a pattern similar to https://{subDomain}.server.org/path/{level}/{col}/{row}.png, where:- "subDomain" is one of the strings in the subDomains collection
- "level" corresponds to a zoom level
- "col" represents the column of the tile
- "row" represents the row of the tile
The subDomains collection must contain at least 1 string value to use the "subDomain" key in the URI template. The URI should be arranged to reflect how the tiles are arranged in the cache or on the server, and can point to a web server (https://) or to a local file cache (file://).
The tiles are assumed to be in the OpenStreetMap tiling scheme, with 256x256 PNG tiles at 96 DPI, the webMercator projection, and an extent of [-180, -85.0511, 180, 85.051].
TileInfo
andLayer.getFullExtent()
are set to OpenStreetMap-compatible defaults.- Parameters:
templateUri
- the template UrisubDomains
- a collection of strings listing available sub-domains- Throws:
IllegalArgumentException
- if templateUri is null or empty- Since:
- 100.1.0
-
WebTiledLayer
Creates a web tiled layer with the specified URI template, tiling scheme information, and extent.Use this constructor to create a WebTiledLayer to integrate non-ArcGIS Services as a layer in a map. The URI template usually follows a pattern similar to https://server.org/path/{level}/{col}/{row}.png, where:
- "level" corresponds to a zoom level
- "col" represents the column of the tile
- "row" represents the row of the tile
The URI should be arranged to reflect how the tiles are arranged in the cache or on the server, and can point to a web server (https://) or to a local file cache (file://).
getSubDomains()
is left empty.- Parameters:
templateUri
- the template UritileInfo
- tile info that specifies details about the tiles, such as DPI, tile size, etc.; can be nullfullExtent
- defines the full extent of the tiles, can be null- Throws:
IllegalArgumentException
- if templateUri is null or empty- Since:
- 100.1.0
-
WebTiledLayer
public WebTiledLayer(String templateUri, Iterable<String> subDomains, TileInfo tileInfo, Envelope fullExtent) Creates a web tiled layer with the given URI template, sub-domain collection, tiling scheme information, and extent.Use this constructor to create a WebTiledLayer to integrate non-ArcGIS Services as a layer in a map. The URI template usually follows a pattern similar to https://{subDomain}.server.org/path/{level}/{col}/{row}.png, where:
- "subDomain" is one of the strings in the subDomains list.
- "level" corresponds to a zoom level.
- "col" represents the column of the tile.
- "row" represents the row of the tile.
The subDomains collection must contain at least 1 string value to use the "subDomain" key in the URI template. The URI should be arranged to reflect how the tiles are arranged in the cache or on the server, and can point to a web server (https://) or to a local file cache (file://).
- Parameters:
templateUri
- the template UrisubDomains
- a collection of strings listing available sub-domainstileInfo
- tile info that specifies details about the tiles, such as DPI, tile size, etc. Can be null.fullExtent
- defines the full extent of the tiles. Can be null.- Throws:
IllegalArgumentException
- if templateUri is null or empty- Since:
- 100.1.0
-
-
Method Details
-
setAttribution
Sets the attribution.- Parameters:
attribution
- the attribution text- Since:
- 100.1.0
-
getTemplateUri
The URI template for this web tiled layer.The template uses the {subDomain} (optional), {level}, {row}, and {col} keys to note how the layer should construct the URI for requesting individual tiles. The URI should be arranged to reflect how the tiles are arranged in the cache or on the server, and can point to a web server (https://) or to a local file cache (file://). Note: the value of
getTemplateUri()
cannot be changed after this layer was loaded.- Returns:
- the template Uri used to create this WebTiledLayer
- Since:
- 100.1.0
-
getSubDomains
Gets the collection of sub-domains that can be used for the "{subDomain}" key in thegetTemplateUri()
.At least one sub-domain must be provided if the
WebTiledLayer.templateUriProperty()
contains a {subDomain} key. Note: the value ofgetSubDomains()
cannot be changed after this layer was loaded.- Returns:
- the collection of sub-domains that can be used for the "{subDomain}" key in the
WebTiledLayer.templateUriProperty()
- Since:
- 100.1.0
-
getUri
Gets a null URI String indicating no specific endpoint URI associated with this WebTiledLayer.- Returns:
- a null URI String
- Since:
- 100.1.0
- See Also:
-
getTileUrl
Description copied from class:ServiceImageTiledLayer
Gets the url to be used to request a tile given the tile key. Note it's important this method does not do any time-consuming work, otherwise tiles may be very slow to display.- Specified by:
getTileUrl
in classServiceImageTiledLayer
- Parameters:
tileKey
- tile key for which the url is to be returned- Returns:
- the url to be used to request a tile, can't be null or empty
-
copy
Creates a deep copy of this WebTiledLayer instance.- Returns:
- a deep copy of this WebTiledLayer instance, which means that copies of all fields of this layer are made including its loading state
- Since:
- 100.1.0
-