All Known Implementing Classes:
AbstractProj, AlbersEqualArea, AzimuthalEquidistant, CassiniSoldner, DoubleStereographic, EquidistantCylindrical, LambertAzimuthalEqualArea, LambertConformalConic, LonLat, Mercator, ObliqueMercator, PolarStereographic, Sinusoidal, SwissObliqueMercator, TransverseMercator

public interface Proj
A projection (in the narrow sense). Converts lat/lon the east/north and the other way around. Datum conversion, false easting / northing, origin of longitude and general scale factor is already applied when the projection is invoked. Lat/lon is not in degrees, but in radians (unlike other parts of JOSM). Additional parameters in the constructor arguments are usually still in degrees. So to avoid confusion, you can follow the convention, that coordinates in radians are called lat_rad/lon_rad or phi/lambda. East/north values are not in meters, but in meters divided by the semi major axis of the ellipsoid (earth radius). (Usually this is what you get anyway, unless you multiply by 'a' somehow implicitly or explicitly.)
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the bounds where this projection is applicable.
    Replies a human readable name of this projection.
    Replies the Proj.4 identifier.
    void
    Initialize the projection using the provided parameters.
    double[]
    invproject(double east, double north)
    Convert east/north to lat/lon.
    boolean
    Return true, if a geographic coordinate reference system is represented.
    default boolean
    Checks whether the result of projecting a lon coordinate only has a linear relation to the east coordinate and is not related to lat/north at all.
    double[]
    project(double latRad, double lonRad)
    Convert lat/lon to east/north.
  • Method Details

    • getName

      Replies a human readable name of this projection.
      Returns:
      The projection name. must not be null.
    • getProj4Id

      Replies the Proj.4 identifier.
      Returns:
      The Proj.4 identifier (as reported by cs2cs -lp). If no id exists, return null.
    • initialize

      Initialize the projection using the provided parameters.
      Parameters:
      params - The projection parameters
      Throws:
      ProjectionConfigurationException - in case parameters are not suitable
    • project

      double[] project(double latRad, double lonRad)
      Convert lat/lon to east/north.
      Parameters:
      latRad - the latitude in radians
      lonRad - the longitude in radians
      Returns:
      array of length 2, containing east and north value in meters, divided by the semi major axis of the ellipsoid.
    • invproject

      double[] invproject(double east, double north)
      Convert east/north to lat/lon.
      Parameters:
      east - east value in meters, divided by the semi major axis of the ellipsoid
      north - north value in meters, divided by the semi major axis of the ellipsoid
      Returns:
      array of length 2, containing lat and lon in radians.
    • getAlgorithmBounds

      Return the bounds where this projection is applicable. This is a fallback for when the projection bounds are not specified explicitly. In this area, the round trip lat/lon → east/north → lat/lon should return the starting value with small error. In addition, regions with extreme distortions should be excluded, if possible. It need not be the absolute maximum, but rather an area that is safe to display in JOSM and contain everything that one would expect to use.
      Returns:
      the bounds where this projection is applicable, null if unknown
    • isGeographic

      boolean isGeographic()
      Return true, if a geographic coordinate reference system is represented. I.e. if it returns latitude/longitude values rather than Cartesian east/north coordinates on a flat surface.
      Returns:
      true, if it is geographic
    • lonIsLinearToEast

      default boolean lonIsLinearToEast()
      Checks whether the result of projecting a lon coordinate only has a linear relation to the east coordinate and is not related to lat/north at all.
      Returns:
      true if lon has a linear relationship to east only.
      Since:
      10805