geotrellis.proj4.Transform.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotrellis-proj4_2.11 Show documentation
Show all versions of geotrellis-proj4_2.11 Show documentation
GeoTrellis is an open source geographic data processing engine for high performance applications.
package geotrellis.proj4
import org.osgeo.proj4j._
object Transform {
def apply(src: CRS, dest: CRS): (Double, Double) => (Double, Double) =
src.alternateTransform(dest) match {
case Some(f) => f
case None => Proj4Transform(src, dest)
}
}
object Proj4Transform {
def apply(src: CRS, dest: CRS): Transform = {
val t = new BasicCoordinateTransform(src.proj4jCrs, dest.proj4jCrs)
{ (x: Double, y: Double) =>
val srcP = new ProjCoordinate(x, y)
val destP = new ProjCoordinate
t.transform(srcP, destP)
(destP.x, destP.y)
}
}
}