-
public abstract class TileSystem
Proxy class for TileSystem. For coordinate conversions (tile to lat/lon and reverse) TileSystem only accepts input parameters within certain ranges and crops any values outside of it. For lat/lon the range is ~(-85,+85) / (-180,+180) and for tile coordinates (0,mapsize-1). Under certain conditions osmdroid creates values outside of these ranges, for example when zooming out and displaying the earth more that once side by side or when scrolling across the 180 degree longitude (international date line). This class fixes this by wrapping input coordinates into a valid range by adding/subtracting the valid span. Example: longitude +185 => -175
-
-
Field Summary
Fields Modifier and Type Field Description public final static double
EarthRadius
public final static double
MinLatitude
public final static double
MaxLatitude
public final static double
MinLongitude
public final static double
MaxLongitude
public final static int
primaryKeyMaxZoomLevel
public final static int
projectionZoomLevel
-
Method Summary
Modifier and Type Method Description static void
setTileSize(int tileSize)
static int
getTileSize()
static int
getMaximumZoomLevel()
static double
getTileSize(double pZoomLevel)
static int
getInputTileZoomLevel(double pZoomLevel)
static int
MapSize(int levelOfDetail)
static double
MapSize(double pZoomLevel)
static double
getFactor(double pZoomLevel)
static double
GroundResolution(double latitude, int levelOfDetail)
static double
GroundResolution(double latitude, double zoomLevel)
static double
GroundResolutionMapSize(double latitude, double mapSize)
Most likely meters/pixel at the given latitude static double
MapScale(double latitude, int levelOfDetail, int screenDpi)
Point
LatLongToPixelXY(double latitude, double longitude, int levelOfDetail, Point reuse)
PointL
LatLongToPixelXY(double latitude, double longitude, double zoomLevel, PointL reuse)
PointL
LatLongToPixelXYMapSize(double latitude, double longitude, double mapSize, PointL reuse)
GeoPoint
PixelXYToLatLong(int pixelX, int pixelY, int levelOfDetail, GeoPoint reuse)
Use getGeoFromMercator instead GeoPoint
PixelXYToLatLong(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)
GeoPoint
PixelXYToLatLongWithoutWrap(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)
double
getX01FromLongitude(double longitude, boolean wrapEnabled)
Converts a longitude to its "X01" value,id est a double between 0 and 1 for the whole longitude range double
getY01FromLatitude(double latitude, boolean wrapEnabled)
Converts a latitude to its "Y01" value,id est a double between 0 and 1 for the whole latitude range abstract double
getX01FromLongitude(double longitude)
Converts a longitude to its "X01" value,Same as getX01FromLongitude but without wrap abstract double
getY01FromLatitude(double pLatitude)
Converts a latitude to its "Y01" value,Same as getY01FromLatitude but without wrap GeoPoint
PixelXYToLatLongMapSize(int pixelX, int pixelY, double mapSize, GeoPoint reuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
GeoPoint
PixelXYToLatLongMapSizeWithoutWrap(int pixelX, int pixelY, double mapSize, GeoPoint reuse)
static double
Clip(double n, double minValue, double maxValue)
Point
PixelXYToTileXY(int pixelX, int pixelY, Point reuse)
Point
PixelXYToTileXY(int pPixelX, int pPixelY, double pTileSize, Point pReuse)
Rect
PixelXYToTileXY(Rect rect, double pTileSize, Rect pReuse)
Point
TileXYToPixelXY(int tileX, int tileY, Point reuse)
PointL
TileXYToPixelXY(int pTileX, int pTileY, double pTileSize, PointL pReuse)
static String
TileXYToQuadKey(int tileX, int tileY, int levelOfDetail)
Use getTileIndex insteadQuadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689. static Point
QuadKeyToTileXY(String quadKey, Point reuse)
Use getX and getY insteadQuadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689. double
getBoundingBoxZoom(BoundingBox pBoundingBox, int pScreenWidth, int pScreenHeight)
double
getLongitudeZoom(double pEast, double pWest, int pScreenWidth)
double
getLatitudeZoom(double pNorth, double pSouth, int pScreenHeight)
long
getMercatorYFromLatitude(double pLatitude, double pMapSize, boolean wrapEnabled)
long
getMercatorXFromLongitude(double pLongitude, double pMapSize, boolean wrapEnabled)
long
getMercatorFromXY01(double pXY01, double pMapSize, boolean wrapEnabled)
double
getLatitudeFromY01(double pY01, boolean wrapEnabled)
Converts a "Y01" value into latitude"Y01" is a double between 0 and 1 for the whole latitude rangeMaxLatitude:0 ... abstract double
getLatitudeFromY01(double pY01)
double
getLongitudeFromX01(double pX01, boolean wrapEnabled)
Converts a "X01" value into longitude"X01" is a double between 0 and 1 for the whole longitude rangeMinLongitude:0 ... abstract double
getLongitudeFromX01(double pX01)
long
getCleanMercator(long pMercator, double pMercatorMapSize, boolean wrapEnabled)
static long
ClipToLong(double pValue, double pMax, boolean pWrapEnabled)
static long
Clip(long n, long minValue, long maxValue)
static int
truncateToInt(long value)
PointL
getMercatorFromGeo(double pLatitude, double pLongitude, double pMapSize, PointL pReuse, boolean wrapEnabled)
GeoPoint
getGeoFromMercator(long pMercatorX, long pMercatorY, double pMapSize, GeoPoint pReuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
double
getXY01FromMercator(long pMercator, double pMapSize, boolean wrapEnabled)
double
getRandomLongitude(double pRandom01)
double
getRandomLatitude(double pRandom01, double pMinLatitude)
double
getRandomLatitude(double pRandom01)
static int
getTileFromMercator(long pMercator, double pTileSize)
static Rect
getTileFromMercator(RectL pMercatorRect, double pTileSize, Rect pReuse)
static long
getMercatorFromTile(int pTile, double pTileSize)
abstract double
getMinLatitude()
abstract double
getMaxLatitude()
abstract double
getMinLongitude()
abstract double
getMaxLongitude()
double
cleanLongitude(double pLongitude)
double
cleanLatitude(double pLatitude)
boolean
isValidLongitude(double pLongitude)
boolean
isValidLatitude(double pLatitude)
String
toStringLongitudeSpan()
String
toStringLatitudeSpan()
int
getTileXFromLongitude(double pLongitude, int pZoom)
int
getTileYFromLatitude(double pLatitude, int pZoom)
double
getLatitudeFromTileY(int pY, int pZoom)
double
getLongitudeFromTileX(int pX, int pZoom)
-
-
Method Detail
-
setTileSize
static void setTileSize(int tileSize)
-
getTileSize
static int getTileSize()
-
getMaximumZoomLevel
static int getMaximumZoomLevel()
-
getTileSize
static double getTileSize(double pZoomLevel)
-
getInputTileZoomLevel
static int getInputTileZoomLevel(double pZoomLevel)
-
MapSize
@Deprecated() static int MapSize(int levelOfDetail)
-
MapSize
static double MapSize(double pZoomLevel)
-
getFactor
static double getFactor(double pZoomLevel)
-
GroundResolution
static double GroundResolution(double latitude, int levelOfDetail)
-
GroundResolution
static double GroundResolution(double latitude, double zoomLevel)
-
GroundResolutionMapSize
static double GroundResolutionMapSize(double latitude, double mapSize)
Most likely meters/pixel at the given latitude
-
MapScale
static double MapScale(double latitude, int levelOfDetail, int screenDpi)
-
LatLongToPixelXY
@Deprecated() Point LatLongToPixelXY(double latitude, double longitude, int levelOfDetail, Point reuse)
-
LatLongToPixelXY
@Deprecated() PointL LatLongToPixelXY(double latitude, double longitude, double zoomLevel, PointL reuse)
-
LatLongToPixelXYMapSize
@Deprecated() PointL LatLongToPixelXYMapSize(double latitude, double longitude, double mapSize, PointL reuse)
-
PixelXYToLatLong
@Deprecated() GeoPoint PixelXYToLatLong(int pixelX, int pixelY, int levelOfDetail, GeoPoint reuse)
Use getGeoFromMercator instead
-
PixelXYToLatLong
@Deprecated() GeoPoint PixelXYToLatLong(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)
-
PixelXYToLatLongWithoutWrap
GeoPoint PixelXYToLatLongWithoutWrap(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)
-
getX01FromLongitude
double getX01FromLongitude(double longitude, boolean wrapEnabled)
Converts a longitude to its "X01" value,id est a double between 0 and 1 for the whole longitude range
-
getY01FromLatitude
double getY01FromLatitude(double latitude, boolean wrapEnabled)
Converts a latitude to its "Y01" value,id est a double between 0 and 1 for the whole latitude range
-
getX01FromLongitude
abstract double getX01FromLongitude(double longitude)
Converts a longitude to its "X01" value,Same as getX01FromLongitude but without wrap
-
getY01FromLatitude
abstract double getY01FromLatitude(double pLatitude)
Converts a latitude to its "Y01" value,Same as getY01FromLatitude but without wrap
-
PixelXYToLatLongMapSize
@Deprecated() GeoPoint PixelXYToLatLongMapSize(int pixelX, int pixelY, double mapSize, GeoPoint reuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
-
PixelXYToLatLongMapSizeWithoutWrap
GeoPoint PixelXYToLatLongMapSizeWithoutWrap(int pixelX, int pixelY, double mapSize, GeoPoint reuse)
-
Clip
static double Clip(double n, double minValue, double maxValue)
-
PixelXYToTileXY
@Deprecated() Point PixelXYToTileXY(int pixelX, int pixelY, Point reuse)
-
PixelXYToTileXY
@Deprecated() Point PixelXYToTileXY(int pPixelX, int pPixelY, double pTileSize, Point pReuse)
-
PixelXYToTileXY
@Deprecated() Rect PixelXYToTileXY(Rect rect, double pTileSize, Rect pReuse)
-
TileXYToPixelXY
@Deprecated() Point TileXYToPixelXY(int tileX, int tileY, Point reuse)
-
TileXYToPixelXY
@Deprecated() PointL TileXYToPixelXY(int pTileX, int pTileY, double pTileSize, PointL pReuse)
-
TileXYToQuadKey
static String TileXYToQuadKey(int tileX, int tileY, int levelOfDetail)
Use getTileIndex insteadQuadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689.aspxWorks only for zoom level >= 1
-
QuadKeyToTileXY
static Point QuadKeyToTileXY(String quadKey, Point reuse)
-
getBoundingBoxZoom
double getBoundingBoxZoom(BoundingBox pBoundingBox, int pScreenWidth, int pScreenHeight)
-
getLongitudeZoom
double getLongitudeZoom(double pEast, double pWest, int pScreenWidth)
-
getLatitudeZoom
double getLatitudeZoom(double pNorth, double pSouth, int pScreenHeight)
-
getMercatorYFromLatitude
long getMercatorYFromLatitude(double pLatitude, double pMapSize, boolean wrapEnabled)
-
getMercatorXFromLongitude
long getMercatorXFromLongitude(double pLongitude, double pMapSize, boolean wrapEnabled)
-
getMercatorFromXY01
long getMercatorFromXY01(double pXY01, double pMapSize, boolean wrapEnabled)
-
getLatitudeFromY01
double getLatitudeFromY01(double pY01, boolean wrapEnabled)
Converts a "Y01" value into latitude"Y01" is a double between 0 and 1 for the whole latitude rangeMaxLatitude:0 ... MinLatitude:1
-
getLatitudeFromY01
abstract double getLatitudeFromY01(double pY01)
-
getLongitudeFromX01
double getLongitudeFromX01(double pX01, boolean wrapEnabled)
Converts a "X01" value into longitude"X01" is a double between 0 and 1 for the whole longitude rangeMinLongitude:0 ... MaxLongitude:1
-
getLongitudeFromX01
abstract double getLongitudeFromX01(double pX01)
-
getCleanMercator
long getCleanMercator(long pMercator, double pMercatorMapSize, boolean wrapEnabled)
-
ClipToLong
static long ClipToLong(double pValue, double pMax, boolean pWrapEnabled)
-
Clip
@Deprecated() static long Clip(long n, long minValue, long maxValue)
-
truncateToInt
static int truncateToInt(long value)
-
getMercatorFromGeo
PointL getMercatorFromGeo(double pLatitude, double pLongitude, double pMapSize, PointL pReuse, boolean wrapEnabled)
-
getGeoFromMercator
GeoPoint getGeoFromMercator(long pMercatorX, long pMercatorY, double pMapSize, GeoPoint pReuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
-
getXY01FromMercator
double getXY01FromMercator(long pMercator, double pMapSize, boolean wrapEnabled)
-
getRandomLongitude
double getRandomLongitude(double pRandom01)
- Parameters:
pRandom01
- [0,1]
-
getRandomLatitude
double getRandomLatitude(double pRandom01, double pMinLatitude)
- Parameters:
pRandom01
- [0,1]
-
getRandomLatitude
double getRandomLatitude(double pRandom01)
- Parameters:
pRandom01
- [0,1]
-
getTileFromMercator
static int getTileFromMercator(long pMercator, double pTileSize)
-
getTileFromMercator
static Rect getTileFromMercator(RectL pMercatorRect, double pTileSize, Rect pReuse)
-
getMercatorFromTile
static long getMercatorFromTile(int pTile, double pTileSize)
-
getMinLatitude
abstract double getMinLatitude()
-
getMaxLatitude
abstract double getMaxLatitude()
-
getMinLongitude
abstract double getMinLongitude()
-
getMaxLongitude
abstract double getMaxLongitude()
-
cleanLongitude
double cleanLongitude(double pLongitude)
-
cleanLatitude
double cleanLatitude(double pLatitude)
-
isValidLongitude
boolean isValidLongitude(double pLongitude)
-
isValidLatitude
boolean isValidLatitude(double pLatitude)
-
toStringLongitudeSpan
String toStringLongitudeSpan()
-
toStringLatitudeSpan
String toStringLatitudeSpan()
-
getTileXFromLongitude
int getTileXFromLongitude(double pLongitude, int pZoom)
-
getTileYFromLatitude
int getTileYFromLatitude(double pLatitude, int pZoom)
-
getLatitudeFromTileY
double getLatitudeFromTileY(int pY, int pZoom)
-
getLongitudeFromTileX
double getLongitudeFromTileX(int pX, int pZoom)
-
-
-
-