-
public abstract class TileSystemProxy 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 doubleEarthRadiuspublic final static doubleMinLatitudepublic final static doubleMaxLatitudepublic final static doubleMinLongitudepublic final static doubleMaxLongitudepublic final static intprimaryKeyMaxZoomLevelpublic final static intprojectionZoomLevel
-
Method Summary
Modifier and Type Method Description static voidsetTileSize(int tileSize)static intgetTileSize()static intgetMaximumZoomLevel()static doublegetTileSize(double pZoomLevel)static intgetInputTileZoomLevel(double pZoomLevel)static intMapSize(int levelOfDetail)static doubleMapSize(double pZoomLevel)static doublegetFactor(double pZoomLevel)static doubleGroundResolution(double latitude, int levelOfDetail)static doubleGroundResolution(double latitude, double zoomLevel)static doubleGroundResolutionMapSize(double latitude, double mapSize)Most likely meters/pixel at the given latitude static doubleMapScale(double latitude, int levelOfDetail, int screenDpi)PointLatLongToPixelXY(double latitude, double longitude, int levelOfDetail, Point reuse)PointLLatLongToPixelXY(double latitude, double longitude, double zoomLevel, PointL reuse)PointLLatLongToPixelXYMapSize(double latitude, double longitude, double mapSize, PointL reuse)GeoPointPixelXYToLatLong(int pixelX, int pixelY, int levelOfDetail, GeoPoint reuse)Use getGeoFromMercator instead GeoPointPixelXYToLatLong(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)GeoPointPixelXYToLatLongWithoutWrap(int pixelX, int pixelY, double zoomLevel, GeoPoint reuse)doublegetX01FromLongitude(double longitude, boolean wrapEnabled)Converts a longitude to its "X01" value,id est a double between 0 and 1 for the whole longitude range doublegetY01FromLatitude(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 doublegetX01FromLongitude(double longitude)Converts a longitude to its "X01" value,Same as getX01FromLongitude but without wrap abstract doublegetY01FromLatitude(double pLatitude)Converts a latitude to its "Y01" value,Same as getY01FromLatitude but without wrap GeoPointPixelXYToLatLongMapSize(int pixelX, int pixelY, double mapSize, GeoPoint reuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)GeoPointPixelXYToLatLongMapSizeWithoutWrap(int pixelX, int pixelY, double mapSize, GeoPoint reuse)static doubleClip(double n, double minValue, double maxValue)PointPixelXYToTileXY(int pixelX, int pixelY, Point reuse)PointPixelXYToTileXY(int pPixelX, int pPixelY, double pTileSize, Point pReuse)RectPixelXYToTileXY(Rect rect, double pTileSize, Rect pReuse)PointTileXYToPixelXY(int tileX, int tileY, Point reuse)PointLTileXYToPixelXY(int pTileX, int pTileY, double pTileSize, PointL pReuse)static StringTileXYToQuadKey(int tileX, int tileY, int levelOfDetail)Use getTileIndex insteadQuadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689. static PointQuadKeyToTileXY(String quadKey, Point reuse)Use getX and getY insteadQuadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689. doublegetBoundingBoxZoom(BoundingBox pBoundingBox, int pScreenWidth, int pScreenHeight)doublegetLongitudeZoom(double pEast, double pWest, int pScreenWidth)doublegetLatitudeZoom(double pNorth, double pSouth, int pScreenHeight)longgetMercatorYFromLatitude(double pLatitude, double pMapSize, boolean wrapEnabled)longgetMercatorXFromLongitude(double pLongitude, double pMapSize, boolean wrapEnabled)longgetMercatorFromXY01(double pXY01, double pMapSize, boolean wrapEnabled)doublegetLatitudeFromY01(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 doublegetLatitudeFromY01(double pY01)doublegetLongitudeFromX01(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 doublegetLongitudeFromX01(double pX01)longgetCleanMercator(long pMercator, double pMercatorMapSize, boolean wrapEnabled)static longClipToLong(double pValue, double pMax, boolean pWrapEnabled)static longClip(long n, long minValue, long maxValue)static inttruncateToInt(long value)PointLgetMercatorFromGeo(double pLatitude, double pLongitude, double pMapSize, PointL pReuse, boolean wrapEnabled)GeoPointgetGeoFromMercator(long pMercatorX, long pMercatorY, double pMapSize, GeoPoint pReuse, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)doublegetXY01FromMercator(long pMercator, double pMapSize, boolean wrapEnabled)doublegetRandomLongitude(double pRandom01)doublegetRandomLatitude(double pRandom01, double pMinLatitude)doublegetRandomLatitude(double pRandom01)static intgetTileFromMercator(long pMercator, double pTileSize)static RectgetTileFromMercator(RectL pMercatorRect, double pTileSize, Rect pReuse)static longgetMercatorFromTile(int pTile, double pTileSize)abstract doublegetMinLatitude()abstract doublegetMaxLatitude()abstract doublegetMinLongitude()abstract doublegetMaxLongitude()doublecleanLongitude(double pLongitude)doublecleanLatitude(double pLatitude)booleanisValidLongitude(double pLongitude)booleanisValidLatitude(double pLatitude)StringtoStringLongitudeSpan()StringtoStringLatitudeSpan()intgetTileXFromLongitude(double pLongitude, int pZoom)intgetTileYFromLatitude(double pLatitude, int pZoom)doublegetLatitudeFromTileY(int pY, int pZoom)doublegetLongitudeFromTileX(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)
-
-
-
-