Class TileIdentifier
- Object
-
- TileIdentifier
-
- Direct Known Subclasses:
BingTileIdentifier
,OSMTileIdentifier
public abstract class TileIdentifier extends Object
A TileIdentifier locates a tile in the grid space of a given tile server by giving its column, row and zoom level. The main responsibility of a TileIdentifier is to translate the grid values (zoom, x, y) into a "code" using an algorithm which denotes the tile in a given server implementation.For example, OpenStreetMap identifies the tile by z/x/y.png; Bing Maps uses a quad key representation.
This class formerly known as "WMTTileName".- Since:
- 12
- Author:
- Tobias Sauerwein, Ugo Taddei
-
-
Constructor Summary
Constructors Constructor Description TileIdentifier(int x, int y, ZoomLevel zoomLevel, String serviceName)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static int
arithmeticMod(int a, int b)
Arithmetic implementation of modulo, as the Java implementation of modulo can return negative values.boolean
equals(Object other)
abstract String
getCode()
Gets the code of a tile.abstract String
getId()
Gets the id of a tile, which can be used for caching purposes.abstract TileIdentifier
getLowerNeighbour()
abstract TileIdentifier
getRightNeighbour()
String
getServiceName()
int
getX()
Gets the column value of a tile.int
getY()
Gets the row value of a tile.int
getZ()
Gets the zoom level (aka "level of detail").ZoomLevel
getZoomLevel()
Gets the row value of a tile.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getZ
public int getZ()
Gets the zoom level (aka "level of detail").Most tile services offer zoom level in the range between 0 (whole world) to 22 (street level). The exact range depends on the service implementation
- Returns:
- the zoom level
-
getX
public int getX()
Gets the column value of a tile.
-
getY
public int getY()
Gets the row value of a tile.
-
getZoomLevel
public ZoomLevel getZoomLevel()
Gets the row value of a tile.
-
getServiceName
public String getServiceName()
-
arithmeticMod
public static final int arithmeticMod(int a, int b)
Arithmetic implementation of modulo, as the Java implementation of modulo can return negative values.arithmeticMod(-1, 8) = 7
- Returns:
- the positive remainder
-
getId
public abstract String getId()
Gets the id of a tile, which can be used for caching purposes.The id is a file-friendly name (that is, should contains no special characters such as ".", "/", etc. The id should be build from the code (which also uniquely identifies a tile, but, in some service implementation may contain file-unfriendly characters (e.g. OpenStreetMap: 5/16/10.png).
When building an id, you should use the service name as a prefix (e.g. for OpenStreetMap: "Mapnik", "CycleMap"; Bing Maps: "Road", "Hybrid"; etc) and suffix the id with a file-friendly string (e.g. OpenStreetMap: "Mapnik_X_Y_Z").
-
getCode
public abstract String getCode()
Gets the code of a tile.The id is a string which uniquely identifies a tile. In some service implementations this is a quadkey (e.g. Bing Maps: "03123") or the fragment of the tile image (e.g. OpenStreetMap: 5/16/10.png, for Z/X/Y.png).
- Returns:
- the code
-
getRightNeighbour
public abstract TileIdentifier getRightNeighbour()
-
getLowerNeighbour
public abstract TileIdentifier getLowerNeighbour()
-
-