Class EquirectangularProjection

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

public class EquirectangularProjection extends Object implements GeographicProjection
Implements the equirectangular map projection, which applies no transformation at all. x and y are therefore the same as longitude and latitude (in degrees).
  • Constructor Details

    • EquirectangularProjection

      public EquirectangularProjection()
  • Method Details

    • toGeo

      public double[] toGeo(double x, double y) throws OutOfProjectionBoundsException
      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
    • fromGeo

      public double[] fromGeo(double longitude, double latitude) throws OutOfProjectionBoundsException
      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
    • metersPerUnit

      public double metersPerUnit()
      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