- All Implemented Interfaces:
RemoteResource
,LayerContent
,Loadable
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 the subDomain
is
one of [a,b,c]
. To provide a custom endpoint instead, use WebTiledLayer(String)
.
An OpenStreetMapLayer
is a preconfigured WebTiledLayer
. 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 a
MapView
or a SceneView
; if using the layer without a
MapView
or a SceneView
, call the Layer.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:
-
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
ConstructorDescriptionCreates an OpenStreetMap layer from the default OpenStreetMap servers. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
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, loadErrorProperty, loadStatusProperty, removeDoneLoadingListener, removeLoadStatusChangedListener, removeVisibilityChangedListener, retryLoadAsync, setCanShowInLegend, setDescription, setId, setMaxScale, setMinScale, setName, setOpacity, setVisible
-
Constructor Details
-
OpenStreetMapLayer
public OpenStreetMapLayer()Creates an OpenStreetMap layer from the default OpenStreetMap servers.- Since:
- 100.1.0
-
-
Method Details
-
setAttribution
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
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
-