Class WebMercator
java.lang.Object
com.codename1.maps.vector.WebMercator
Spherical Web Mercator (EPSG:3857) helpers expressed in "world pixels" --
the slippy-map coordinate space where the whole world spans
tileSize * 2^zoom pixels. All of the vector engine's panning and tile
math is done in this space.
These are the standard OSM tiling formulas; kept here (rather than reusing
the projected Mercator) so the renderer can work in
fractional pixels at fractional zoom without round-tripping through the
legacy Coord projection flag.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe canonical tile edge length in pixels. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublelatToWorldY(double lat, double zoom) Latitude in degrees to an absolute world-pixel y atzoom.static doublelonToWorldX(double lon, double zoom) Longitude in degrees to an absolute world-pixel x atzoom.static doublesinh(double x) Hyperbolic sine, absent from the minimal deviceMath.static doubleworldSize(double zoom) The world width/height in pixels atzoom(may be fractional).static doubleworldXToLon(double worldX, double zoom) World-pixel x atzoomback to longitude in degrees.static doubleworldYToLat(double worldY, double zoom) World-pixel y atzoomback to latitude in degrees.
-
Field Details
-
TILE_SIZE
public static final int TILE_SIZEThe canonical tile edge length in pixels.- See Also:
-
-
Method Details
-
worldSize
public static double worldSize(double zoom) The world width/height in pixels atzoom(may be fractional). -
lonToWorldX
public static double lonToWorldX(double lon, double zoom) Longitude in degrees to an absolute world-pixel x atzoom. -
latToWorldY
public static double latToWorldY(double lat, double zoom) Latitude in degrees to an absolute world-pixel y atzoom. -
worldXToLon
public static double worldXToLon(double worldX, double zoom) World-pixel x atzoomback to longitude in degrees. -
worldYToLat
public static double worldYToLat(double worldY, double zoom) World-pixel y atzoomback to latitude in degrees. -
sinh
public static double sinh(double x) Hyperbolic sine, absent from the minimal deviceMath.
-