Class PlanitCrsUtils


  • public class PlanitCrsUtils
    extends Object
    Utilities for coordinate Reference systems
    Author:
    markr
    • Constructor Detail

      • PlanitCrsUtils

        public PlanitCrsUtils()
    • Method Detail

      • silenceHsqlLogging

        protected static void silenceHsqlLogging()
        make sure we silence the Hsql logging that is used by CRS to collect crs for different countries. Make sure this is called BEFORE it is loaded, otherwise it is too late
      • createCoordinateReferenceSystem

        public static org.opengis.referencing.crs.CoordinateReferenceSystem createCoordinateReferenceSystem​(String code)
        create a coordinate reference system instance based on String representation, e.g. "EPSG:4326" for WGS84", using the underlying geotools hsql authority factory. see also https://docs.geotools.org/latest/userguide/library/referencing/crs.html on some context on why we include the hsql dependency in the planit build to ensure that the provided crs codes here can actually be transformed into a viable CRS and why it makes sense to provide this simple wrapper method in this utility class

        always make sure you lookup the CRS via this method as it ensures the logging of PLANit is not messed up by the geotools-HSQL dependency since we programmatically disallow it to overwrite our logging configuration in the static initialiser of this class.

        Parameters:
        code - for the CRS
        Returns:
        the created coordinate reference system