Package org.locationtech.proj4j
Class CRSFactory
java.lang.Object
org.locationtech.proj4j.CRSFactory
A factory which can create
CoordinateReferenceSystem
s
from a variety of ways
of specifying them.
This is the primary way of creating coordinate systems
for carrying out projections transformations.
CoordinateReferenceSystems can be used to
define CoordinateTransform
s to perform transformations
on ProjCoordinate
s.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateFromName
(String name) Creates aCoordinateReferenceSystem
(CRS) from a well-known name.createFromParameters
(String name, String paramStr) Creates aCoordinateReferenceSystem
from a PROJ.4 projection parameter string.createFromParameters
(String name, String[] params) Creates aCoordinateReferenceSystem
defined by an array of PROJ.4 projection parameters.Gets theRegistry
used by this factory.readEpsgFromParameters
(String paramStr) Finds a EPSG Code from a PROJ.4 projection parameter string.readEpsgFromParameters
(String[] params) Finds a EPSG Code defined by an array of PROJ.4 projection parameters.private static String[]
splitParameters
(String paramStr)
-
Field Details
-
csReader
-
registry
-
-
Constructor Details
-
CRSFactory
public CRSFactory()
-
-
Method Details
-
getRegistry
Gets theRegistry
used by this factory.- Returns:
- the Registry
-
createFromName
public CoordinateReferenceSystem createFromName(String name) throws UnsupportedParameterException, InvalidValueException, UnknownAuthorityCodeException Creates aCoordinateReferenceSystem
(CRS) from a well-known name. CRS names are of the form: "authority:code", with the components being:- authority is a code for a namespace supported by PROJ.4. Currently supported values are EPSG, ESRI, WORLD, NA83, NAD27. If no authority is provided, the EPSG namespace is assumed.
- code is the id of a coordinate system in the authority namespace. For example, in the EPSG namespace a code is an integer value which identifies a CRS definition in the EPSG database. (Codes are read and handled as strings).
- Parameters:
name
- the name of a coordinate system, with optional authority prefix- Returns:
- the
CoordinateReferenceSystem
corresponding to the given name - Throws:
UnsupportedParameterException
- if a PROJ.4 parameter is not supportedInvalidValueException
- if a parameter value is invalidUnknownAuthorityCodeException
- if the authority code cannot be found
-
createFromParameters
public CoordinateReferenceSystem createFromParameters(String name, String paramStr) throws UnsupportedParameterException, InvalidValueException Creates aCoordinateReferenceSystem
from a PROJ.4 projection parameter string.An example of a valid PROJ.4 projection parameter string is:
+proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 +lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +units=m
- Parameters:
name
- a name for this coordinate system (may be null for an anonymous coordinate system)paramStr
- a PROJ.4 projection parameter string- Returns:
- the specified
CoordinateReferenceSystem
- Throws:
UnsupportedParameterException
- if a given PROJ.4 parameter is not supportedInvalidValueException
- if a supplied parameter value is invalid
-
createFromParameters
public CoordinateReferenceSystem createFromParameters(String name, String[] params) throws UnsupportedParameterException, InvalidValueException Creates aCoordinateReferenceSystem
defined by an array of PROJ.4 projection parameters. PROJ.4 parameters are generally of the form "+name=value".- Parameters:
name
- a name for this coordinate system (may be null)params
- an array of PROJ.4 projection parameters- Returns:
- a
CoordinateReferenceSystem
- Throws:
UnsupportedParameterException
- if a PROJ.4 parameter is not supportedInvalidValueException
- if a parameter value is invalid
-
readEpsgFromParameters
Finds a EPSG Code from a PROJ.4 projection parameter string.An example of a valid PROJ.4 projection parameter string is:
+proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 +lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +units=m
- Parameters:
paramStr
- a PROJ.4 projection parameter string- Returns:
- the specified
CoordinateReferenceSystem
- Throws:
IOException
- if there was an issue in reading EPSG file
-
readEpsgFromParameters
Finds a EPSG Code defined by an array of PROJ.4 projection parameters. PROJ.4 parameters are generally of the form "+name=value".- Parameters:
params
- an array of PROJ.4 projection parameters- Returns:
- s String EPSG code
- Throws:
IOException
- if there was an issue in reading EPSG file
-
splitParameters
-