Class FactoryUsingWKT

    • Field Detail

      • FILENAME

        public static final String FILENAME
        The default filename to read. The default FactoryUsingWKT implementation will search for the first occurence of this file in the following places:

        • In the directory specified by the system property.
        • In every org/geotools/referencing/factory/espg directories found on the classpath.

        The filename part before the extension ("epsg") denotes the authority namespace where to register the content of this file. The user-directory given by the system property may contains other property files for other authorities, like "esri.properties", but those additional authorities are not handled by the default FactoryUsingWKT class.

        See Also:
        getDefinitionsURL(), Constant Field Values
      • DEFAULT_PRIORITY

        protected static final int DEFAULT_PRIORITY
        Default priority for this factory.
        Since:
        2.4
        See Also:
        Constant Field Values
    • Constructor Detail

      • FactoryUsingWKT

        public FactoryUsingWKT()
        Constructs an authority factory using the default set of factories.
      • FactoryUsingWKT

        public FactoryUsingWKT​(Hints userHints)
        Constructs an authority factory using a set of factories created from the specified hints. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.
      • FactoryUsingWKT

        public FactoryUsingWKT​(Hints userHints,
                               int priority)
        Constructs an authority factory using the specified hints and priority.
    • Method Detail

      • getAuthorities

        protected Citation[] getAuthorities()
        Returns the set of authorities to use as identifiers for the CRS to be created. This set is given to the properties-backed factory constructor.

        The default implementation returns a singleton containing only EPSG. Subclasses should override this method in order to enumerate all relevant authorities, with EPSG in last position. For example EsriExtension returns {ESRI, EPSG}.

        Since:
        2.4
      • getDefinitionsURL

        protected URL getDefinitionsURL()
        Returns the URL to the property file that contains CRS definitions. The default implementation performs the following search path:
        • If a value is set for the system property key, then the "epsg.properties" file will be searched in this directory.
        • If no value is set for the above-cited system property, or if no "epsg.properties" file was found in that directory, then the first "epsg.properties" file found in any org/geotools/referencing/factory/epsg directory on the classpath will be used.
        • If no file was found on the classpath neither, then this factory will be disabled.
        Returns:
        The URL, or null if none.
      • getFactory

        protected static final <T extends AbstractAuthorityFactory> T getFactory​(String authority,
                                                                                 Class<T> type)
      • reportDuplicatedCodes

        public Set reportDuplicatedCodes​(PrintWriter out)
                                  throws FactoryException
        Prints a list of codes that duplicate the ones provided by ThreadedEpsgFactory. This is used for implementation of main method 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.
        Parameters:
        out - The writer where to print the report.
        Returns:
        The set of duplicated codes.
        Throws:
        FactoryException - if an error occured.
        Since:
        2.4
      • reportInstantiationFailures

        public Set reportInstantiationFailures​(PrintWriter out)
                                        throws FactoryException
        Prints a list of CRS that can't be instantiated. This is used for implementation of main method 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.
        Parameters:
        out - The writer where to print the report.
        Returns:
        The set of codes that can't be instantiated.
        Throws:
        FactoryException - if an error occured while fetching authority codes.
        Since:
        2.4
      • main

        public static void main​(String... args)
                         throws FactoryException
        Prints a list of codes that duplicate the ones provided in the ThreadedEpsgFactory. The factory tested is the one registered in ReferencingFactoryFinder. By default, this is this FactoryUsingWKT class backed by the "epsg.properties" property file. This method can be invoked from the command line in order to check the content of the property file. Valid arguments are:

        -testTry to instantiate all CRS and reports any failure to do so.
        -duplicatedList all codes from the WKT factory that are duplicating a code from the SQL factory.
        Parameters:
        args - Command line arguments.
        Throws:
        FactoryException - if an error occured.
        Since:
        2.4