# Class WebMercator

java.lang.Object
com.codename1.maps.vector.WebMercator

public final class WebMercator extends Object

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

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `TILE_SIZE`
  The canonical tile edge length in pixels.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static double`
  `latToWorldY(double lat, double zoom)`
  Latitude in degrees to an absolute world-pixel y at `zoom`.
  `static double`
  `lonToWorldX(double lon, double zoom)`
  Longitude in degrees to an absolute world-pixel x at `zoom`.
  `static double`
  `sinh(double x)`
  Hyperbolic sine, absent from the minimal device `Math`.
  `static double`
  `worldSize(double zoom)`
  The world width/height in pixels at `zoom` (may be fractional).
  `static double`
  `worldXToLon(double worldX, double zoom)`
  World-pixel x at `zoom` back to longitude in degrees.
  `static double`
  `worldYToLat(double worldY, double zoom)`
  World-pixel y at `zoom` back to latitude in degrees.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TILE_SIZE

    public static final int TILE_SIZE
    The canonical tile edge length in pixels.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### worldSize

    public static double worldSize(double zoom)
    The world width/height in pixels at `zoom` (may be fractional).

  - ### lonToWorldX

    public static double lonToWorldX(double lon, double zoom)
    Longitude in degrees to an absolute world-pixel x at `zoom`.

  - ### latToWorldY

    public static double latToWorldY(double lat, double zoom)
    Latitude in degrees to an absolute world-pixel y at `zoom`.

  - ### worldXToLon

    public static double worldXToLon(double worldX, double zoom)
    World-pixel x at `zoom` back to longitude in degrees.

  - ### worldYToLat

    public static double worldYToLat(double worldY, double zoom)
    World-pixel y at `zoom` back to latitude in degrees.

  - ### sinh

    public static double sinh(double x)
    Hyperbolic sine, absent from the minimal device `Math`.