Class CRSFactory
java.lang.Object
org.locationtech.proj4j.CRSFactory
A factory which can create
CoordinateReferenceSystems
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 CoordinateTransforms to perform transformations
on ProjCoordinates.
-
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 aCoordinateReferenceSystemfrom a PROJ.4 projection parameter string.createFromParameters(String name, String[] params) Creates aCoordinateReferenceSystemdefined by an array of PROJ.4 projection parameters.Gets theRegistryused 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
-
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:authorityis a code for a namespace supported by PROJ.4. Currently supported values areEPSG,ESRI,WORLD,NA83,NAD27. If no authority is provided, theEPSGnamespace is assumed.codeis the id of a coordinate system in the authority namespace. For example, in theEPSGnamespace a code is an integer value which identifies a CRS definition in the EPSG database. (Codes are read and handled as strings).
EPSG:3005.- Parameters:
name- the name of a coordinate system, with optional authority prefix- Returns:
- the
CoordinateReferenceSystemcorresponding 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 aCoordinateReferenceSystemfrom 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 benullfor 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 aCoordinateReferenceSystemdefined 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
-