Class CoordinateTransform

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

public final class CoordinateTransform extends Object implements AutoCloseable
Converts points and boxes from a source projection to a destination projection, and back. * 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

    • between

      public static CoordinateTransform between(Projection source, Projection dest)
      A transform between two projections. It copies them, so you may close yours afterwards.
    • between

      public static CoordinateTransform between(String source, String dest)
      A transform between two projections given as epsg:<code> or PROJ strings.
    • isIdentity

      public boolean isIdentity()
      True if source and destination are the same, so coordinates do not change.
    • forward

      public Point2d forward(double x, double y)
      A point from the source projection to the destination projection.
    • forward

      public Point2d forward(Point2d p)
    • backward

      public Point2d backward(double x, double y)
      A point from the destination projection back to the source projection.
    • backward

      public Point2d backward(Point2d p)
    • forward

      public Box2d forward(Box2d box)
      A box from the source to the destination projection: the bounds of its four transformed corners.
    • forward

      public Box2d forward(Box2d box, int pointsPerEdge)
      Like forward(Box2d), but also samples pointsPerEdge points along each edge, so the result covers edges that bulge when projected. Use it for large boxes.
    • backward

      public Box2d backward(Box2d box)
      A box from the destination back to the source projection.
    • backward

      public Box2d backward(Box2d box, int pointsPerEdge)
    • close

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