Package org.geotools.referencing.factory
Class PropertyAuthorityFactory
- Object
-
- AbstractFactory
-
- ReferencingFactory
-
- AbstractAuthorityFactory
-
- DirectAuthorityFactory
-
- PropertyAuthorityFactory
-
- All Implemented Interfaces:
AuthorityFactory
,CRSAuthorityFactory
,CSAuthorityFactory
,DatumAuthorityFactory
,Factory
,Factory
,RegistrableFactory
public class PropertyAuthorityFactory extends DirectAuthorityFactory implements CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory
Default implementation for a coordinate reference system authority factory backed by a property file. This gives some of the benificts of using the EPSG database backed authority factory (for example), in a portable property file.This factory doesn't cache any result. Any call to a
createFoo
method will trig a new WKT parsing. For caching, this factory should be wrapped in some buffered factory likeBufferedAuthorityFactory
.- Since:
- 2.1
- Author:
- Jody Garnett, Rueben Schulz, Martin Desruisseaux
-
-
Field Summary
-
Fields inherited from class DirectAuthorityFactory
factories
-
Fields inherited from class ReferencingFactory
LOGGER
-
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
-
-
Constructor Summary
Constructors Constructor Description PropertyAuthorityFactory(ReferencingFactoryContainer factories, Citation[] authorities, URL definitions)
Creates a factory for the specified authorities from the specified file.PropertyAuthorityFactory(ReferencingFactoryContainer factories, Citation authority, URL definitions)
Creates a factory for the specified authority from the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoordinateReferenceSystem
createCoordinateReferenceSystem(String code)
Returns a coordinate reference system from a code.IdentifiedObject
createObject(String code)
Returns an arbitrary object from a code.Citation
getAuthority()
Returns the organization or party responsible for definition and maintenance of the database.Set<String>
getAuthorityCodes(Class<? extends IdentifiedObject> type)
Returns the set of authority codes of the given type.InternationalString
getDescriptionText(String code)
Gets a description of the object corresponding to a code.String
getWKT(String code)
Returns the Well Know Text from a code.protected String
trimAuthority(String code)
Trims the authority scope, if present.-
Methods inherited from class DirectAuthorityFactory
getImplementationHints
-
Methods inherited from class AbstractAuthorityFactory
createCartesianCS, createCompoundCRS, createCoordinateOperation, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createDatum, createDerivedCRS, createEllipsoid, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createExtent, createFromCoordinateReferenceSystemCodes, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createOperationMethod, createParameterDescriptor, createPolarCS, createPrimeMeridian, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createUnit, createVerticalCRS, createVerticalCS, createVerticalDatum, dispose, getBackingStoreDescription, getIdentifiedObjectFinder, noSuchAuthorityCode
-
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
-
Methods inherited from class AbstractFactory
addImplementationHints, equals, getPriority, hashCode, onDeregistration, onRegistration, toString
-
Methods inherited from interface CRSAuthorityFactory
createCompoundCRS, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
-
Methods inherited from interface CSAuthorityFactory
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS
-
Methods inherited from interface DatumAuthorityFactory
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum
-
-
-
-
Constructor Detail
-
PropertyAuthorityFactory
public PropertyAuthorityFactory(ReferencingFactoryContainer factories, Citation authority, URL definitions) throws IOException
Creates a factory for the specified authority from the specified file.- Parameters:
factories
- The underlying factories used for objects creation.authority
- The organization or party responsible for definition and maintenance of the database.definitions
- URL to the definition file.- Throws:
IOException
- if the definitions can't be read.
-
PropertyAuthorityFactory
public PropertyAuthorityFactory(ReferencingFactoryContainer factories, Citation[] authorities, URL definitions) throws IOException
Creates a factory for the specified authorities from the specified file. More than one authority may be specified when the CRS to create should have more than one identifier, each with the same code but different namespace. For example a factory for CRS defined by ESRI uses the"ESRI"
namespace, but also the"EPSG"
namespace because those CRS are used as extension of the EPSG database. Concequently, the same CRS can be identified as"ESRI:53001"
and"EPSG:53001"
, where"53001"
is a unused code in the official EPSG database.- Parameters:
factories
- The underlying factories used for objects creation.authorities
- The organizations or party responsible for definition and maintenance of the database.definitions
- URL to the definition file.- Throws:
IOException
- if the definitions can't be read.- Since:
- 2.4
-
-
Method Detail
-
getAuthority
public Citation getAuthority()
Returns the organization or party responsible for definition and maintenance of the database.- Specified by:
getAuthority
in interfaceAuthorityFactory
- Specified by:
getAuthority
in classAbstractAuthorityFactory
- Returns:
- The organization reponsible for definition of the database.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) 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 bycreateGeographicCRS
,createProjectedCRS
,createVerticalCRS
,createTemporalCRS
and their friends.ProjectedCRS.class
asks only for authority codes accepted bycreateProjectedCRS
.
"PROJCS"
and"GEOGCS"
at the start of the WKT strings.- Specified by:
getAuthorityCodes
in interfaceAuthorityFactory
- Parameters:
type
- The spatial reference objects type (may beObject.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.
-
getWKT
public String getWKT(String code) throws NoSuchAuthorityCodeException
Returns the Well Know Text from a code.- Parameters:
code
- Value allocated by authority.- Returns:
- The Well Know Text (WKT) for the specified code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.
-
getDescriptionText
public InternationalString getDescriptionText(String code) throws NoSuchAuthorityCodeException, FactoryException
Gets a description of the object corresponding to a code.- Specified by:
getDescriptionText
in interfaceAuthorityFactory
- Parameters:
code
- Value allocated by authority.- Returns:
- A description of the object, or
null
if the object corresponding to the specifiedcode
has no description. - Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the query failed for some other reason.
-
createObject
public IdentifiedObject createObject(String code) throws NoSuchAuthorityCodeException, FactoryException
Returns an arbitrary object from a code. If the object type is know at compile time, it is recommended to invoke the most precise method instead of this one.- Specified by:
createObject
in interfaceAuthorityFactory
- Overrides:
createObject
in classAbstractAuthorityFactory
- Parameters:
code
- Value allocated by authority.- Returns:
- The object for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
AbstractAuthorityFactory.createCoordinateReferenceSystem(java.lang.String)
,AbstractAuthorityFactory.createDatum(java.lang.String)
,AbstractAuthorityFactory.createEllipsoid(java.lang.String)
,AbstractAuthorityFactory.createUnit(java.lang.String)
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws NoSuchAuthorityCodeException, FactoryException
Returns a coordinate reference system from a code. If the object type is know at compile time, it is recommended to invoke the most precise method instead of this one.- Specified by:
createCoordinateReferenceSystem
in interfaceCRSAuthorityFactory
- Overrides:
createCoordinateReferenceSystem
in classAbstractAuthorityFactory
- Parameters:
code
- Value allocated by authority.- Returns:
- The coordinate reference system for the given code.
- Throws:
NoSuchAuthorityCodeException
- if the specifiedcode
was not found.FactoryException
- if the object creation failed for some other reason.- See Also:
AbstractAuthorityFactory.createGeographicCRS(java.lang.String)
,AbstractAuthorityFactory.createProjectedCRS(java.lang.String)
,AbstractAuthorityFactory.createVerticalCRS(java.lang.String)
,AbstractAuthorityFactory.createTemporalCRS(java.lang.String)
,AbstractAuthorityFactory.createCompoundCRS(java.lang.String)
-
trimAuthority
protected String trimAuthority(String code)
Trims the authority scope, if present. If more than one authority were given at construction time, then any of them may appears as the scope in the supplied code.- Overrides:
trimAuthority
in classAbstractAuthorityFactory
- Parameters:
code
- The code to trim.- Returns:
- The code without the authority scope.
-
-