Class EPSGCRSAuthorityFactory
- Object
-
- AbstractFactory
-
- EPSGCRSAuthorityFactory
-
- All Implemented Interfaces:
AuthorityFactory,CRSAuthorityFactory,Factory,Factory,RegistrableFactory
public class EPSGCRSAuthorityFactory extends AbstractFactory implements CRSAuthorityFactory
Default implementation for a coordinate reference system authority factory backed by the EPSG property file. This gives most of the benifits of using the EPSG database backed authority factory, in a nice, portable property file.- Author:
- Jody Garnett, Rueben Schulz
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUTHORITYstatic StringAUTHORITY_PREFIXprotected CRSFactorycrsFactoryprotected static EPSGCRSAuthorityFactoryDEFAULTThe default coordinate system authority factory.protected PropertiesepsgThe properties object for our properties file.-
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
-
-
Constructor Summary
Constructors Modifier Constructor Description EPSGCRSAuthorityFactory()Loads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.protectedEPSGCRSAuthorityFactory(CRSFactory factory)Loads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.protectedEPSGCRSAuthorityFactory(CRSFactory factory, URL definition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompoundCRScreateCompoundCRS(String str)Creates a 3D coordinate reference system from a code.CoordinateReferenceSystemcreateCoordinateReferenceSystem(String code)Returns an arbitrary coordinate reference system from a code.DerivedCRScreateDerivedCRS(String str)Creates a derived coordinate reference system from a code.EngineeringCRScreateEngineeringCRS(String str)Create a engineering coordinate reference system from a code.GeocentricCRScreateGeocentricCRS(String str)Returns a geocentric coordinate reference system from a code.GeographicCRScreateGeographicCRS(String code)Returns a geographic coordinate reference system from a code.ImageCRScreateImageCRS(String str)Create a image coordinate reference system from a code.IdentifiedObjectcreateObject(String code)Returns an arbitrary object from a code.ProjectedCRScreateProjectedCRS(String code)Returns a projected coordinate reference system from a code.TemporalCRScreateTemporalCRS(String str)Create a temporal coordinate reference system from a code.VerticalCRScreateVerticalCRS(String str)Create a vertical coordinate reference system from a code.CitationgetAuthority()Returns the organization or party responsible for definition and maintenance of the database.Set<String>getAuthorityCodes(Class clazz)Returns the set of authority codes of the given type.static CRSAuthorityFactorygetDefault()Returns a default coordinate system factory backed by the EPSG property file.InternationalStringgetDescriptionText(String code)Gets a description of the object corresponding to a code.ObjectFactorygetObjectFactory()CitationgetVendor()Returns the vendor responsible for creating this factory implementation.protected voidloadDefault()Loads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.-
Methods inherited from class AbstractFactory
addImplementationHints, equals, getImplementationHints, getPriority, hashCode, onDeregistration, onRegistration, toString
-
-
-
-
Field Detail
-
AUTHORITY
public static final String AUTHORITY
- See Also:
- Constant Field Values
-
AUTHORITY_PREFIX
public static final String AUTHORITY_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT
protected static EPSGCRSAuthorityFactory DEFAULT
The default coordinate system authority factory. Will be constructed only when first requested.
-
epsg
protected Properties epsg
The properties object for our properties file. Keys are the EPSG code for a coordinate reference system and the associated value is a WKT string for the CRS.
-
crsFactory
protected CRSFactory crsFactory
-
-
Constructor Detail
-
EPSGCRSAuthorityFactory
public EPSGCRSAuthorityFactory()
Loads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.
-
EPSGCRSAuthorityFactory
protected EPSGCRSAuthorityFactory(CRSFactory factory)
Loads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.
-
EPSGCRSAuthorityFactory
protected EPSGCRSAuthorityFactory(CRSFactory factory, URL definition) throws FactoryException
- Throws:
FactoryException
-
-
Method Detail
-
loadDefault
protected void loadDefault() throws IOExceptionLoads from epsg.properties if the file exists, defaults to internal defintions exported from postgis and cubeworks.- Throws:
IOException
-
getDefault
public static CRSAuthorityFactory getDefault()
Returns a default coordinate system factory backed by the EPSG property file.- Returns:
- The default factory.
- Throws:
SQLException- if the connection to the database can't be etablished.
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException
Description copied from interface:CRSAuthorityFactoryReturns an arbitrary coordinate reference system from a code. If the coordinate reference system type is know at compile time, it is recommended to invoke the most precise method instead of this one (for examplecreateGeographicCRS(code)instead ofcreateCoordinateReferenceSystem(code)if the caller know he is asking for a geographic coordinate reference system).- Specified by:
createCoordinateReferenceSystemin interfaceCRSAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
CRSAuthorityFactory.createGeographicCRS(java.lang.String),CRSAuthorityFactory.createProjectedCRS(java.lang.String),CRSAuthorityFactory.createVerticalCRS(java.lang.String),CRSAuthorityFactory.createTemporalCRS(java.lang.String),CRSAuthorityFactory.createCompoundCRS(java.lang.String)
-
createObject
public IdentifiedObject createObject(String code) throws FactoryException
Description copied from interface:AuthorityFactoryReturns an arbitrary object from a code. The returned object will typically be an instance ofDatum,CoordinateSystem,ReferenceSystemorCoordinateOperation. If the type of the object is know at compile time, it is recommended to invoke the most precise method instead of this one (for examplecreateCoordinateReferenceSystem(code)instead ofcreateObject(code)if the caller know he is asking for a coordinate reference system).- Specified by:
createObjectin interfaceAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The object for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
DatumAuthorityFactory.createDatum(java.lang.String),CRSAuthorityFactory.createCoordinateReferenceSystem(java.lang.String)
-
createProjectedCRS
public ProjectedCRS createProjectedCRS(String code) throws FactoryException
Description copied from interface:CRSAuthorityFactoryReturns a projected coordinate reference system from a code.- Specified by:
createProjectedCRSin interfaceCRSAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
DatumAuthorityFactory.createGeodeticDatum(java.lang.String)
-
createGeographicCRS
public GeographicCRS createGeographicCRS(String code) throws FactoryException
Description copied from interface:CRSAuthorityFactoryReturns a geographic coordinate reference system from a code.- Specified by:
createGeographicCRSin interfaceCRSAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
DatumAuthorityFactory.createGeodeticDatum(java.lang.String)
-
getAuthority
public Citation getAuthority()
Description copied from interface:AuthorityFactoryReturns the organization or party responsible for definition and maintenance of the database.- Specified by:
getAuthorityin interfaceAuthorityFactory- Returns:
- The organization reponsible for definition of the database.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class clazz) throws FactoryException
Returns the set of authority codes of the given type. The type argument specify the base class. For example if this factory is an instance of CRSAuthorityFactory, then:- CoordinateReferenceSystem.class asks for all authority codes accepted by createGeographicCRS, createProjectedCRS, createVerticalCRS, createTemporalCRS and their friends.
- ProjectedCRS.class asks only for authority codes accepted by createProjectedCRS.
- Specified by:
getAuthorityCodesin interfaceAuthorityFactory- Parameters:
clazz- The spatial reference objects type (may be Object.class).- Returns:
- The set of authority codes for spatial reference objects of the given type. If this factory doesn't contains any object of the given type, then this method returns an empty set.
- Throws:
FactoryException- if access to the underlying database failed.
-
getObjectFactory
public ObjectFactory getObjectFactory()
-
getVendor
public Citation getVendor()
Description copied from interface:FactoryReturns the vendor responsible for creating this factory implementation. Many implementations may be available for the same factory interface. Implementations are usually managed by a service registry.
-
getDescriptionText
public InternationalString getDescriptionText(String code) throws FactoryException
Description copied from interface:AuthorityFactoryGets a description of the object corresponding to a code.- Specified by:
getDescriptionTextin interfaceAuthorityFactory- Parameters:
code- Value allocated by authority.- Returns:
- A description of the object, or
nullif the object corresponding to the specifiedcodehas no description. - Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the query failed for some other reason.
-
createCompoundCRS
public CompoundCRS createCompoundCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreates a 3D coordinate reference system from a code.- Specified by:
createCompoundCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.
-
createDerivedCRS
public DerivedCRS createDerivedCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreates a derived coordinate reference system from a code.- Specified by:
createDerivedCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.
-
createEngineeringCRS
public EngineeringCRS createEngineeringCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreate a engineering coordinate reference system from a code.- Specified by:
createEngineeringCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.
-
createGeocentricCRS
public GeocentricCRS createGeocentricCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryReturns a geocentric coordinate reference system from a code.- Specified by:
createGeocentricCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed.- See Also:
DatumAuthorityFactory.createGeodeticDatum(java.lang.String)
-
createImageCRS
public ImageCRS createImageCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreate a image coordinate reference system from a code.- Specified by:
createImageCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.
-
createTemporalCRS
public TemporalCRS createTemporalCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreate a temporal coordinate reference system from a code.- Specified by:
createTemporalCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
DatumAuthorityFactory.createTemporalDatum(java.lang.String)
-
createVerticalCRS
public VerticalCRS createVerticalCRS(String str) throws FactoryException
Description copied from interface:CRSAuthorityFactoryCreate a vertical coordinate reference system from a code.- Specified by:
createVerticalCRSin interfaceCRSAuthorityFactory- Parameters:
str- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException- if the specifiedcodewas not found.FactoryException- if the object creation failed for some other reason.- See Also:
DatumAuthorityFactory.createVerticalDatum(java.lang.String)
-
-