public class

OpenStreetMapLayer

extends TiledServiceLayer
java.lang.Object
   ↳ com.esri.android.map.Layer
     ↳ com.esri.android.map.TiledLayer
       ↳ com.esri.android.map.TiledServiceLayer
         ↳ com.esri.android.map.osm.OpenStreetMapLayer

Class Overview

A tile service layer that supports OpenStreetMap (OSM) tile servers.

Default tile servers used are:

  • http://[a,b,c].tile.openstreetmap.org
The additional tile servers can be found on the OpenStreetMap web site.

If access to the tile servers require a key that should not be hard-coded into the URL string, then the URLs can have a placeholder for key identified by "{KEY}". setKey(String) can be used replace the placeholder with actual key at runtime.

NOTE: Attribution is provided for the default tile servers. Please check whether it is appropriate at the time of usage. Refer to Tile usage policy to provide attribution appropriate to the tile servers used.

Summary

Constants
double XMAX Maximum X coordinate in meters for the full extent.
double XMIN Minimum X coordinate in meters for the full extent.
double YMAX Maximum Y coordinate in meters for the full extent.
double YMIN Minimum Y coordinate in meters for the full extent.
[Expand]
Inherited Constants
From class com.esri.android.map.TiledServiceLayer
[Expand]
Inherited Fields
From class com.esri.android.map.TiledServiceLayer
From class com.esri.android.map.TiledLayer
From class com.esri.android.map.Layer
Public Constructors
OpenStreetMapLayer()
Default constructor for OpenStreetMapLayer.
OpenStreetMapLayer(boolean initLayer)
The constructor for OpenStreetMapLayer.
OpenStreetMapLayer(String[] tileServerURLs, int minZoomLevel, int maxZoomLevel, String attributionText, boolean initLayer)
Constructs an instance of OpenStreetMapLayer with specified tile servers.
Public Methods
String getAttributionText()
Returns the attribution text.
int getMaxZoomLevel()
Returns the maximum zoom level.
int getMinZoomLevel()
Returns the minimum zoom level.
String[] getTileServerURLs()
The URLs used to fetch tiles from.
void setKey(String key)
Replaces the placeholder "{KEY}" in the tile server URLs.
Protected Methods
byte[] getTile(int lev, int col, int row)
Override this method to implement fetching tiles from a tile service
void initLayer()
Initializes the layer.
[Expand]
Inherited Methods
From class com.esri.android.map.TiledServiceLayer
From class com.esri.android.map.TiledLayer
From class com.esri.android.map.Layer
From class java.lang.Object
From interface com.esri.android.map.popup.PopupLayer

Constants

public static final double XMAX

Maximum X coordinate in meters for the full extent.

Constant Value: 2.003750834278E7

public static final double XMIN

Minimum X coordinate in meters for the full extent.

Constant Value: -2.003750834278E7

public static final double YMAX

Maximum Y coordinate in meters for the full extent.

Constant Value: 2.003750834278E7

public static final double YMIN

Minimum Y coordinate in meters for the full extent.

Constant Value: -2.003750834278E7

Public Constructors

public OpenStreetMapLayer ()

Default constructor for OpenStreetMapLayer.

public OpenStreetMapLayer (boolean initLayer)

The constructor for OpenStreetMapLayer.

Parameters
initLayer boolean: true or false. The layer will be initialized if it is true.

public OpenStreetMapLayer (String[] tileServerURLs, int minZoomLevel, int maxZoomLevel, String attributionText, boolean initLayer)

Constructs an instance of OpenStreetMapLayer with specified tile servers.

Parameters
tileServerURLs String: tile servers that follow OSM specification to fetch tiles from.
minZoomLevel int: minimum zoom level
maxZoomLevel int: maximum zoom level
attributionText String: attribution to be used.
initLayer boolean: boolean, true to initialize the layer otherwise not.

Public Methods

public String getAttributionText ()

Returns the attribution text.

Returns
String the attribution text.

public int getMaxZoomLevel ()

Returns the maximum zoom level.

Returns
int the maximum zoom level.

public int getMinZoomLevel ()

Returns the minimum zoom level.

Returns
int the minimum zoom level.

public String[] getTileServerURLs ()

The URLs used to fetch tiles from.

Returns
String[] set of URLs.

public void setKey (String key)

Replaces the placeholder "{KEY}" in the tile server URLs.

Example:
String tileServerURL = "http://a.tile.cloudmade.com/{KEY}/3/256/";
After setKey("081abc");
tileServerURL = "http://a.tile.cloudmade.com/081abc/3/256/";

Parameters
key String: key to be used.

Protected Methods

protected byte[] getTile (int lev, int col, int row)

Override this method to implement fetching tiles from a tile service

Parameters
lev int: an integer representing the scale level
col int: an integer representing the column
row int: an integer representing the row
Returns
byte[] byte array of tiles
Throws
Exception

protected void initLayer ()

Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.