public final class MercatorProjection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
EARTH_CIRCUMFERENCE
The circumference of the earth at the equator in meters.
|
static double |
LATITUDE_MAX
Maximum possible latitude coordinate of the map.
|
static double |
LATITUDE_MIN
Minimum possible latitude coordinate of the map.
|
Modifier and Type | Method and Description |
---|---|
static double |
calculateGroundResolution(double latitude,
long mapSize)
Calculates the distance on the ground that is represented by a single pixel on the map.
|
static double |
calculateGroundResolutionWithScaleFactor(double latitude,
double scaleFactor,
int tileSize)
Calculates the distance on the ground that is represented by a single pixel on the map.
|
static LatLong |
fromPixels(double pixelX,
double pixelY,
long mapSize)
Get LatLong from Pixels.
|
static LatLong |
fromPixelsWithScaleFactor(double pixelX,
double pixelY,
double scaleFactor,
int tileSize)
Get LatLong from Pixels.
|
static long |
getMapSize(byte zoomLevel,
int tileSize) |
static long |
getMapSizeWithScaleFactor(double scaleFactor,
int tileSize) |
static Point |
getPixel(LatLong latLong,
long mapSize) |
static Point |
getPixelAbsolute(LatLong latLong,
long mapSize)
Calculates the absolute pixel position for a map size and tile size
|
static Point |
getPixelRelative(LatLong latLong,
long mapSize,
double x,
double y)
Calculates the absolute pixel position for a map size and tile size relative to origin
|
static Point |
getPixelRelative(LatLong latLong,
long mapSize,
Point origin)
Calculates the absolute pixel position for a map size and tile size relative to origin
|
static Point |
getPixelRelativeToTile(LatLong latLong,
Tile tile)
Calculates the absolute pixel position for a tile and tile size relative to origin
|
static Point |
getPixelWithScaleFactor(LatLong latLong,
double scaleFactor,
int tileSize) |
static double |
latitudeToPixelY(double latitude,
byte zoomLevel,
int tileSize)
Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain zoom level.
|
static double |
latitudeToPixelY(double latitude,
long mapSize)
Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain map size.
|
static double |
latitudeToPixelYWithScaleFactor(double latitude,
double scaleFactor,
int tileSize)
Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain scale.
|
static int |
latitudeToTileY(double latitude,
byte zoomLevel)
Converts a latitude coordinate (in degrees) to a tile Y number at a certain zoom level.
|
static int |
latitudeToTileYWithScaleFactor(double latitude,
double scaleFactor)
Converts a latitude coordinate (in degrees) to a tile Y number at a certain scale.
|
static double |
longitudeToPixelX(double longitude,
byte zoomLevel,
int tileSize)
Converts a longitude coordinate (in degrees) to a pixel X coordinate at a certain zoom level.
|
static double |
longitudeToPixelX(double longitude,
long mapSize)
Converts a longitude coordinate (in degrees) to a pixel X coordinate at a certain map size.
|
static double |
longitudeToPixelXWithScaleFactor(double longitude,
double scaleFactor,
int tileSize)
Converts a longitude coordinate (in degrees) to a pixel X coordinate at a certain scale factor.
|
static int |
longitudeToTileX(double longitude,
byte zoomLevel)
Converts a longitude coordinate (in degrees) to the tile X number at a certain zoom level.
|
static int |
longitudeToTileXWithScaleFactor(double longitude,
double scaleFactor)
Converts a longitude coordinate (in degrees) to the tile X number at a certain scale factor.
|
static double |
metersToPixels(float meters,
double latitude,
long mapSize)
Converts meters to pixels at latitude for zoom-level.
|
static double |
metersToPixelsWithScaleFactor(float meters,
double latitude,
double scaleFactor,
int tileSize)
Converts meters to pixels at latitude for zoom-level.
|
static double |
pixelXToLongitude(double pixelX,
long mapSize)
Converts a pixel X coordinate at a certain map size to a longitude coordinate.
|
static double |
pixelXToLongitudeWithScaleFactor(double pixelX,
double scaleFactor,
int tileSize)
Converts a pixel X coordinate at a certain scale to a longitude coordinate.
|
static int |
pixelXToTileX(double pixelX,
byte zoomLevel,
int tileSize)
Converts a pixel X coordinate to the tile X number.
|
static int |
pixelXToTileXWithScaleFactor(double pixelX,
double scaleFactor,
int tileSize)
Converts a pixel X coordinate to the tile X number.
|
static double |
pixelYToLatitude(double pixelY,
long mapSize)
Converts a pixel Y coordinate at a certain map size to a latitude coordinate.
|
static double |
pixelYToLatitudeWithScaleFactor(double pixelY,
double scaleFactor,
int tileSize)
Converts a pixel Y coordinate at a certain scale to a latitude coordinate.
|
static int |
pixelYToTileY(double pixelY,
byte zoomLevel,
int tileSize)
Converts a pixel Y coordinate to the tile Y number.
|
static int |
pixelYToTileYWithScaleFactor(double pixelY,
double scaleFactor,
int tileSize)
Converts a pixel Y coordinate to the tile Y number.
|
static double |
scaleFactorToZoomLevel(double scaleFactor)
Converts a scaleFactor to a zoomLevel.
|
static long |
tileToPixel(long tileNumber,
int tileSize) |
static double |
tileXToLongitude(long tileX,
byte zoomLevel)
Converts a tile X number at a certain zoom level to a longitude coordinate.
|
static double |
tileXToLongitudeWithScaleFactor(long tileX,
double scaleFactor)
Converts a tile X number at a certain scale to a longitude coordinate.
|
static double |
tileYToLatitude(long tileY,
byte zoomLevel)
Converts a tile Y number at a certain zoom level to a latitude coordinate.
|
static double |
tileYToLatitudeWithScaleFactor(long tileY,
double scaleFactor)
Converts a tile Y number at a certain scale to a latitude coordinate.
|
static double |
zoomLevelToScaleFactor(byte zoomLevel)
Converts a zoom level to a scale factor.
|
public static final double EARTH_CIRCUMFERENCE
public static final double LATITUDE_MAX
public static final double LATITUDE_MIN
public static double calculateGroundResolutionWithScaleFactor(double latitude, double scaleFactor, int tileSize)
latitude
- the latitude coordinate at which the resolution should be calculated.scaleFactor
- the scale at which the resolution should be calculated.public static double calculateGroundResolution(double latitude, long mapSize)
latitude
- the latitude coordinate at which the resolution should be calculated.mapSize
- precomputed size of map.public static LatLong fromPixelsWithScaleFactor(double pixelX, double pixelY, double scaleFactor, int tileSize)
public static LatLong fromPixels(double pixelX, double pixelY, long mapSize)
public static long getMapSizeWithScaleFactor(double scaleFactor, int tileSize)
scaleFactor
- the scale factor for which the size of the world map should be returned.java.lang.IllegalArgumentException
- if the given scale factor is < 1public static long getMapSize(byte zoomLevel, int tileSize)
zoomLevel
- the zoom level for which the size of the world map should be returned.java.lang.IllegalArgumentException
- if the given zoom level is negative.public static Point getPixelWithScaleFactor(LatLong latLong, double scaleFactor, int tileSize)
public static Point getPixelAbsolute(LatLong latLong, long mapSize)
latLong
- the geographic position.mapSize
- precomputed size of map.public static Point getPixelRelative(LatLong latLong, long mapSize, double x, double y)
latLong
- the geographic position.mapSize
- precomputed size of map.public static Point getPixelRelative(LatLong latLong, long mapSize, Point origin)
latLong
- the geographic position.mapSize
- precomputed size of map.public static Point getPixelRelativeToTile(LatLong latLong, Tile tile)
latLong
- the geographic position.tile
- tilepublic static double latitudeToPixelYWithScaleFactor(double latitude, double scaleFactor, int tileSize)
latitude
- the latitude coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static double latitudeToPixelY(double latitude, byte zoomLevel, int tileSize)
latitude
- the latitude coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.public static double latitudeToPixelY(double latitude, long mapSize)
latitude
- the latitude coordinate that should be converted.mapSize
- precomputed size of map.public static int latitudeToTileYWithScaleFactor(double latitude, double scaleFactor)
latitude
- the latitude coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static int latitudeToTileY(double latitude, byte zoomLevel)
latitude
- the latitude coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.public static double longitudeToPixelXWithScaleFactor(double longitude, double scaleFactor, int tileSize)
longitude
- the longitude coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static double longitudeToPixelX(double longitude, byte zoomLevel, int tileSize)
longitude
- the longitude coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.tileSize
- the tile sizepublic static double longitudeToPixelX(double longitude, long mapSize)
longitude
- the longitude coordinate that should be converted.mapSize
- precomputed size of map.public static int longitudeToTileXWithScaleFactor(double longitude, double scaleFactor)
longitude
- the longitude coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static int longitudeToTileX(double longitude, byte zoomLevel)
longitude
- the longitude coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.public static double metersToPixelsWithScaleFactor(float meters, double latitude, double scaleFactor, int tileSize)
meters
- the meters to convertlatitude
- the latitude for the conversion.scaleFactor
- the scale factor for the conversion.public static double metersToPixels(float meters, double latitude, long mapSize)
meters
- the meters to convertlatitude
- the latitude for the conversion.mapSize
- precomputed size of map.public static double pixelXToLongitudeWithScaleFactor(double pixelX, double scaleFactor, int tileSize)
pixelX
- the pixel X coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.java.lang.IllegalArgumentException
- if the given pixelX coordinate is invalid.public static double pixelXToLongitude(double pixelX, long mapSize)
pixelX
- the pixel X coordinate that should be converted.mapSize
- precomputed size of map.java.lang.IllegalArgumentException
- if the given pixelX coordinate is invalid.public static int pixelXToTileXWithScaleFactor(double pixelX, double scaleFactor, int tileSize)
pixelX
- the pixel X coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static int pixelXToTileX(double pixelX, byte zoomLevel, int tileSize)
pixelX
- the pixel X coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize)
pixelY
- the pixel Y coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.java.lang.IllegalArgumentException
- if the given pixelY coordinate is invalid.public static double pixelYToLatitude(double pixelY, long mapSize)
pixelY
- the pixel Y coordinate that should be converted.mapSize
- precomputed size of map.java.lang.IllegalArgumentException
- if the given pixelY coordinate is invalid.public static int pixelYToTileYWithScaleFactor(double pixelY, double scaleFactor, int tileSize)
pixelY
- the pixel Y coordinate that should be converted.scaleFactor
- the scale factor at which the coordinate should be converted.public static int pixelYToTileY(double pixelY, byte zoomLevel, int tileSize)
pixelY
- the pixel Y coordinate that should be converted.zoomLevel
- the zoom level at which the coordinate should be converted.public static double scaleFactorToZoomLevel(double scaleFactor)
scaleFactor
- the scale factor to convert to a zoom level.public static long tileToPixel(long tileNumber, int tileSize)
tileNumber
- the tile number that should be converted.public static double tileXToLongitudeWithScaleFactor(long tileX, double scaleFactor)
tileX
- the tile X number that should be converted.scaleFactor
- the scale factor at which the number should be converted.public static double tileXToLongitude(long tileX, byte zoomLevel)
tileX
- the tile X number that should be converted.zoomLevel
- the zoom level at which the number should be converted.public static double tileYToLatitudeWithScaleFactor(long tileY, double scaleFactor)
tileY
- the tile Y number that should be converted.scaleFactor
- the scale factor at which the number should be converted.public static double tileYToLatitude(long tileY, byte zoomLevel)
tileY
- the tile Y number that should be converted.zoomLevel
- the zoom level at which the number should be converted.public static double zoomLevelToScaleFactor(byte zoomLevel)
zoomLevel
- the zoom level to convert.