Class Projection

java.lang.Object
dev.avelar.mapnik.Projection
All Implemented Interfaces:
AutoCloseable

public final class Projection extends Object implements AutoCloseable
A coordinate reference system, such as epsg:3857 or a PROJ string. Converts between geographic (longitude, latitude) and projected coordinates. To convert between two projections, use CoordinateTransform. Safe to share between threads: calls on one object take turns. (For speed, give each thread its own, which takes microseconds to make.)
  • Method Details

    • of

      public static Projection of(String params)
      Create from epsg:<code> or a PROJ string. Throws MapnikException if it is invalid.
    • params

      public String params()
      The string this projection was created from.
    • definition

      public String definition()
      The PROJ definition.
    • description

      public String description()
      A human-readable name, for example WGS 84.
    • isGeographic

      public boolean isGeographic()
      True for longitude/latitude systems.
    • areaOfUse

      public Optional<Box2d> areaOfUse()
      The geographic area the projection is meant for, if known, as longitude/latitude degrees.
    • forward

      public Point2d forward(double lon, double lat)
      Geographic (x = longitude, y = latitude) to this projection's coordinates.
    • inverse

      public Point2d inverse(double x, double y)
      This projection's coordinates to geographic (x = longitude, y = latitude).
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable