Class OpenStreetMapLayer
-
- All Implemented Interfaces:
RemoteResource
,LayerContent
,Loadable
public final class OpenStreetMapLayer extends WebTiledLayer
A layer that requests images from OpenStreetMap servers.OpenStreetMap (OSM) is a project to create a free, publicly editable map of the world. This layer displays map content from OpenStreetMap tile servers, using the endpoint pattern
https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png
, where thesubDomain
is one of[a,b,c]
. To provide a custom endpoint instead, useWebTiledLayer(String)
.An
OpenStreetMapLayer
is a preconfiguredWebTiledLayer
. Unlike a web tiled layer, it comes with predefined attribution and does not support identify, query, selection, or time. Performance of OSM layers is similar to web tiled layer performance. Raster tiles are read from the service as needed by the map.Use of OpenStreetMap's tiles is subject to their tile usage policy. Before using an OpenStreetMap layer in your app, consider that service availability is not guaranteed. Apps with high demand may be denied access at any time. There are many organizations providing OpenStreetMap tiles. Consider using one of these services (or hosting your own) if you anticipate high demand.
Example for working with an OpenStreetMapLayer
OpenStreetMapLayer openStreetMapLayer = new OpenStreetMapLayer(); openStreetMapLayer.addDoneLoadingListener(new Runnable() { public void run() { if (openStreetMapLayer.getLoadStatus() == LoadStatus.LOADED) { // work with the layer here } } }); map.setBasemap(new Basemap(openStreetMapLayer)); mapView.setMap(map);
The layer is loaded when displayed in aMapView
or aSceneView
; if using the layer without aMapView
or aSceneView
, call theLayer.loadAsync()
method. Use the layer done loading event to determine when the layer is ready, and check the loaded status before using the layer.- Since:
- 100.1.0
- See Also:
Layer
,WebTiledLayer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esri.arcgisruntime.layers.ImageTiledLayer
ImageTiledLayer.BufferSize, ImageTiledLayer.NoDataTileBehavior
-
-
Constructor Summary
Constructors Constructor Description OpenStreetMapLayer()
Creates an instance of OpenStreetMapLayer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenStreetMapLayer
copy()
Creates a deep copy of this OpenStreetMapLayer instance.void
setAttribution(String attribution)
Throws UnsupportedOperationException.-
Methods inherited from class com.esri.arcgisruntime.layers.WebTiledLayer
getSubDomains, getTemplateUri, getTileUrl, getUri
-
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, removeDoneLoadingListener, removeLoadStatusChangedListener, removeVisibilityChangedListener, retryLoadAsync, setCanShowInLegend, setDescription, setId, setMaxScale, setMinScale, setName, setOpacity, setVisible
-
-
-
-
Method Detail
-
setAttribution
public void setAttribution(String attribution)
Throws UnsupportedOperationException. Attribution text of an OpenStreetMapLayer cannot be changed.- Overrides:
setAttribution
in classWebTiledLayer
- Parameters:
attribution
- the attribution text- Throws:
UnsupportedOperationException
- always throws this exception- Since:
- 100.1.0
-
copy
public OpenStreetMapLayer copy()
Creates a deep copy of this OpenStreetMapLayer instance.- Overrides:
copy
in classWebTiledLayer
- Returns:
- a deep copy of this OpenStreetMapLayer instance, which means that copies of all fields of this layer are made including its loading state
- Since:
- 100.1.0
-
-