Class TransverseMercatorProjection

java.lang.Object
net.buildtheearth.terraminusminus.projection.mercator.TransverseMercatorProjection
All Implemented Interfaces:
GeographicProjection

public class TransverseMercatorProjection extends Object implements GeographicProjection
Implementation of the universal transverse Mercator projection.
See Also:
  • Field Details

    • ZONE_WIDTH

      public static final double ZONE_WIDTH
      Width of a longitude range in radians. The 360 degrees of longitude are divided into chunks of this size, and each zone gets its own central meridian to use for the universal projection.
  • Constructor Details

    • TransverseMercatorProjection

      public TransverseMercatorProjection()
  • Method Details

    • getCentralMeridian

      public static double getCentralMeridian(double longitude)
      Parameters:
      longitude - - longitude in radians
      Returns:
      the central meridian to use when projecting at the given longitude, in radians
    • fromGeo

      public double[] fromGeo(double longitude, double latitude) throws OutOfProjectionBoundsException
      Description copied from interface: GeographicProjection
      Converts geographic coordinates to map coordinates
      Specified by:
      fromGeo in interface GeographicProjection
      Parameters:
      longitude - - longitude, in degrees
      latitude - - latitude, in degrees
      Returns:
      {x, y} map coordinates
      Throws:
      OutOfProjectionBoundsException - if the specified point on the geographic space cannot be mapped to a point of the projected space
    • toGeo

      public double[] toGeo(double x, double y) throws OutOfProjectionBoundsException
      Description copied from interface: GeographicProjection
      Converts map coordinates to geographic coordinates
      Specified by:
      toGeo in interface GeographicProjection
      Parameters:
      x - - x map coordinate
      y - - y map coordinate
      Returns:
      {longitude, latitude} in degrees
      Throws:
      OutOfProjectionBoundsException - if the specified point on the projected space cannot be mapped to a point of the geographic space
    • metersPerUnit

      public double metersPerUnit()
      Description copied from interface: GeographicProjection
      Gives an estimation of the scale of this projection. This is just an estimation, as distortion is inevitable when projecting a sphere onto a flat surface, so this value varies from places to places in reality.
      Specified by:
      metersPerUnit in interface GeographicProjection
      Returns:
      an estimation of the scale of this projection
    • toString

      public String toString()
      Overrides:
      toString in class Object