org.geotoolkit.referencing.factory.epsg
Class PropertyEpsgFactory

Object
  extended by Factory
      extended by ReferencingFactory
          extended by AbstractAuthorityFactory
              extended by DirectAuthorityFactory
                  extended by WKTParsingAuthorityFactory
                      extended by PropertyAuthorityFactory
                          extended by PropertyEpsgFactory
All Implemented Interfaces:
AuthorityFactory, CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, Factory

@ThreadSafe
public class PropertyEpsgFactory
extends PropertyAuthorityFactory
implements CRSAuthorityFactory

Authority factory for Coordinate Reference Systems beyong the one defined in the EPSG database. This factory is used as a fallback when a requested code is not found in the EPSG database, or when there is no connection at all to the EPSG database. The CRS are defined as Well Known Text in a property file named "epsg.properties". The search path is as below, in that order:

  1. If a value for Hints.CRS_AUTHORITY_EXTRA_DIRECTORY exists in the hints map given at construction time, then that value will be used as the directory where to search for the "epsg.properties" file. Reminder: such hint can be defined system-wide for convenience.

  2. The "epsg.properties" files found in all org/geotoolkit/referencing/factory/epsg directories on the classpath are merged with the values found in previous step, if any. If the same value is defined twice, the value of previous step have precedence.

This factory can also be used to provide custom extensions or overrides to a main EPSG factory:


Caching of CRS objects
This factory doesn't cache any result. Any call to a createFoo method will trig a new WKT parsing. For adding caching service, this factory should be wrapped in CachingAuthorityFactory. Note that this is done automatically when this factory is used through the CRS static methods.


Troubleshotting
If the "epsg.properties" file is on the classpath but seems to be ignored, the following actions may provide some useful informations:

Since:
2.1
Version:
3.00
Author:
Martin Desruisseaux (IRD), Jody Garnett (Refractions), Rueben Schulz (UBC), Andrea Aime (TOPP)
Module:
referencing/geotk-referencing (download)    View source code for this class

Nested Class Summary
 
Nested classes/interfaces inherited from class Factory
Factory.Availability, Factory.Organizer
 
Field Summary
static String FILENAME
          The default filename to read, which is "epsg.properties".
 
Fields inherited from class DirectAuthorityFactory
factories
 
Fields inherited from class AbstractAuthorityFactory
nameFactory
 
Fields inherited from class ReferencingFactory
LOGGER
 
Fields inherited from class Factory
EMPTY_HINTS, hints
 
Constructor Summary
PropertyEpsgFactory()
          Constructs a default authority factory.
PropertyEpsgFactory(Hints userHints)
          Constructs an authority factory from the given hints.
PropertyEpsgFactory(Hints userHints, String filename, Citation... authorities)
          Constructs an authority factory for the given authorities.
 
Method Summary
 Set<String> reportDuplicates(PrintWriter out)
          Prints a list of codes that duplicate the ones provided by ThreadedEpsgFactory.
 Set<String> reportInstantiationFailures(PrintWriter out)
          Prints a list of CRS that can't be instantiated.
protected  void setOrdering(Factory.Organizer organizer)
          Invoked by FactoryRegistry on registration.
 
Methods inherited from class PropertyAuthorityFactory
dispose, load
 
Methods inherited from class WKTParsingAuthorityFactory
availability, createCoordinateReferenceSystem, createObject, getAuthority, getAuthorityCodes, getDescriptionText, getIdentifiedObjectFinder, trimAuthority
 
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, getBackingStoreDescription, noSuchAuthorityCode
 
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
 
Methods inherited from class Factory
equals, hasCompatibleHints, hashCode, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface CRSAuthorityFactory
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
 
Methods inherited from interface AuthorityFactory
createObject, getAuthority, getAuthorityCodes, getDescriptionText
 
Methods inherited from interface Factory
getVendor
 
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
 

Field Detail

FILENAME

public static final String FILENAME
The default filename to read, which is "epsg.properties". The default PropertyEpsgFactory implementation will search for every occurrences of org/geotoolkit/referencing/factory/espg/epsg.properties on the classpath. However a different directory for this filename can be specified using Hints.CRS_AUTHORITY_EXTRA_DIRECTORY.

See Also:
Constant Field Values
Constructor Detail

PropertyEpsgFactory

public PropertyEpsgFactory()
                    throws IOException
Constructs a default authority factory.

Throws:
IOException - If an error occurred while reading the definition files. Note that do exception is thrown if there is no file - in this case the factory is only considered not available.

PropertyEpsgFactory

public PropertyEpsgFactory(Hints userHints)
                    throws IOException
Constructs an authority factory from the given hints. Hints of special interest are:

This constructor recognizes also CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

Parameters:
userHints - An optional set of hints, or null if none.
Throws:
IOException - If an error occurred while reading the definition files. Note that do exception is thrown if there is no file - in this case the factory is only considered not available.

PropertyEpsgFactory

public PropertyEpsgFactory(Hints userHints,
                           String filename,
                           Citation... authorities)
                    throws IOException
Constructs an authority factory for the given authorities. This constructor recognizes the same hints than PropertyEpsgFactory(Hints). The authorities argument should enumerate all relevant authorities, with EPSG in last position. For example EsriExtension returns {ESRI, EPSG}.

Parameters:
userHints - An optional set of hints, or null if none.
filename - The name of the file to look in the Hints.CRS_AUTHORITY_EXTRA_DIRECTORY directory and in every org/geotoolkit/referencing/factory/espg directories found on the classpath.
authorities - The organizations or parties responsible for definition and maintenance of the database. Should contains at least Citations.EPSG.
Throws:
IOException - If an error occurred while reading the definition files. Note that do exception is thrown if there is no file - in this case the factory is only considered not available.
Since:
3.00
Method Detail

setOrdering

protected void setOrdering(Factory.Organizer organizer)
Invoked by FactoryRegistry on registration. The default implementation declares that this factory should give precedence to ThreadedEpsgFactory and LongitudeFirstEpsgFactory.

Overrides:
setOrdering in class Factory

reportDuplicates

public Set<String> reportDuplicates(PrintWriter out)
                             throws FactoryException
Prints a list of codes that duplicate the ones provided by ThreadedEpsgFactory. This is used in order to check the content of the "epsg.properties" file (or whatever property file used as backing store for this factory) from the command line.
java -jar geotk-referencing.jar test duplicates

Parameters:
out - The writer where to print the report.
Returns:
The set of duplicated codes.
Throws:
FactoryException - if an error occurred.
Since:
2.4
See Also:
ReferencingCommands.test()

reportInstantiationFailures

public Set<String> reportInstantiationFailures(PrintWriter out)
                                        throws FactoryException
Prints a list of CRS that can't be instantiated. This is used in order to check the content of the "epsg.properties" file (or whatever property file used as backing store for this factory) from the command line. To lauch from the command line, use the following:
java -jar geotk-referencing.jar test creates

Parameters:
out - The writer where to print the report.
Returns:
The set of codes that can't be instantiated.
Throws:
FactoryException - if an error occurred while fetching authority codes.
Since:
2.4
See Also:
ReferencingCommands.test()


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.