public final class Proj4 extends Static
Proj4Factory
.Defined in the sis-gdal
module
Modifier and Type | Method and Description |
---|---|
static CoordinateReferenceSystem |
createCRS(String definition,
int dimension)
Creates a new CRS from the given Proj.4 definition string.
|
static CoordinateOperation |
createOperation(CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS,
boolean force)
Creates an operation for conversion or transformation between two coordinate reference systems.
|
static String |
definition(CoordinateReferenceSystem crs)
Infers a Proj.4 definition from the given projected, geographic or geocentric coordinate reference system.
|
static String |
version()
Returns the version number of the Proj.4 library.
|
public static String version()
null
if Proj.4 is not installed on the current system.
null
if the native library has been found.public static String definition(CoordinateReferenceSystem crs) throws FactoryException
crs
- the coordinate reference system for which to create a Proj.4 definition.FactoryException
- if the Proj.4 definition string can not be created from the given CRS.public static CoordinateReferenceSystem createCRS(String definition, int dimension) throws FactoryException
"+init=epsg:3395 +over"
(see warning below)"+proj=latlong +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
"+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +ellps=WGS84 +towgs84=0,0,0"
"epsg"
word, coordinate reference systems created by "+init=epsg:"
syntax are not necessarily compliant with EPSG definitions. In particular, the axis order is often different.
Units of measurement may also differ.definition
- the Proj.4 definition string.dimension
- the number of dimension of the CRS to create (2 or 3).NullPointerException
- if the definition string is null
.IllegalArgumentException
- if the definition string is empty or the dimension argument is out of range.UnavailableFactoryException
- if the Proj.4 native library is not available.FactoryException
- if the CRS creation failed for another reason.Proj4Factory.createCoordinateReferenceSystem(String)
public static CoordinateOperation createOperation(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, boolean force) throws FactoryException
force
is false
, then this method returns null
.Recommended alternative
Provided that an EPSG database is available, Apache SISCRS.findOperation(…)
method produces results that are closer
to the authoritative definitions of coordinate operations (technically, Apache SIS referencing
engine is a late-binding implementation while Proj.4 is an early-binding
implementation — see EPSG guidance notes for a definition of late versus early-binding approaches).
Apache SIS also attaches metadata about
coordinate operation accuracy and
domain of validity, have extended support of
multi-dimensional CRS and provides transform derivatives. This Proj4.createOperation(…)
method should
be reserved to situations where an application needs to reproduce the same numerical results than Proj.4.sourceCRS
- the source coordinate reference system.targetCRS
- the target coordinate reference system.force
- whether to force the creation of a Proj.4 transform
even if the given CRS are not wrappers around Proj.4 data structures.null
if the given CRS are not wrappers around Proj.4 data structures and force
is false.UnavailableFactoryException
- if force
is true
and the Proj.4 native library is not available.FactoryException
- if force
is true
and this method can not create Proj.4 transform
for the given pair of coordinate reference systems for another reason.Proj4Factory.createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem, boolean)
,
CRS.findOperation(CoordinateReferenceSystem, CoordinateReferenceSystem, GeographicBoundingBox)
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.