Package org.meteoinfo.projection.proj4j
Class CRSFactory
- java.lang.Object
-
- org.meteoinfo.projection.proj4j.CRSFactory
-
public class CRSFactory extends java.lang.ObjectA factory which can createCoordinateReferenceSystems 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 onProjCoordinates.
-
-
Constructor Summary
Constructors Constructor Description CRSFactory()Creates a new factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoordinateReferenceSystemcreateFromEsriString(java.lang.String esriString)Create a CoordinateReferenceSystem by Esri projection stringCoordinateReferenceSystemcreateFromName(java.lang.String name)Creates aCoordinateReferenceSystem(CRS) from a well-known name.CoordinateReferenceSystemcreateFromParameters(java.lang.String name, java.lang.String paramStr)Creates aCoordinateReferenceSystemfrom a PROJ.4 projection parameter string.CoordinateReferenceSystemcreateFromParameters(java.lang.String name, java.lang.String[] params)Creates aCoordinateReferenceSystemdefined by an array of PROJ.4 projection parameters.RegistrygetRegistry()Gets theRegistryused by this factory.
-
-
-
Method Detail
-
getRegistry
public Registry getRegistry()
Gets theRegistryused by this factory.- Returns:
- the Registry
-
createFromName
public CoordinateReferenceSystem createFromName(java.lang.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
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(java.lang.String name, java.lang.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 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(java.lang.String name, java.lang.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
-
createFromEsriString
public CoordinateReferenceSystem createFromEsriString(java.lang.String esriString)
Create a CoordinateReferenceSystem by Esri projection string- Parameters:
esriString- Esri projection string- Returns:
- CoordinateReferenceSystem
-
-