Class MercatorProjection

java.lang.Object
org.deltava.util.tile.MercatorProjection
All Implemented Interfaces:
Projection

public class MercatorProjection extends Object implements Projection
A utility class for translating canvas coordinates to latitude and longitude using the Microsoft Virtual Earth and Google Maps modified Mercator projection.
Since:
5.0
Version:
7.0
Author:
Luke
  • Field Details

  • Constructor Details

    • MercatorProjection

      public MercatorProjection(int zoom)
      Initializes the projection.
      Parameters:
      zoom - the zoom level
  • Method Details

    • getZoomLevel

      public int getZoomLevel()
      Returns the zoom level.
      Specified by:
      getZoomLevel in interface Projection
      Returns:
      the zoom level
    • getAddress

      public TileAddress getAddress(GeoLocation loc)
      Returns the address of a Tile containing the provided point.
      Specified by:
      getAddress in interface Projection
      Parameters:
      loc - the GeoLocation
      Returns:
      the TileAddress of the Tile containing this point at the current zoom level
    • getPixelAddress

      public Point getPixelAddress(GeoLocation loc)
      Returns the pixel address of the provided point on the global canvas.
      Specified by:
      getPixelAddress in interface Projection
      Parameters:
      loc - the GeoLocation
      Returns:
      a Point with the pixel coordinates
    • getGeoPosition

      public GeoLocation getGeoPosition(int x, int y)
      Returns the latitude/longitude of a pixel on the global canvas.
      Specified by:
      getGeoPosition in interface Projection
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      Returns:
      a GeoLocation