Class Projections


  • public final class Projections
    extends java.lang.Object
    Class to manage projections. Use this class to query available projection or register new projections from a plugin.
    • Method Detail

      • loadNadgrids

        private static void loadNadgrids​(java.lang.String definition)
      • registerBaseProjection

        public static void registerBaseProjection​(java.lang.String id,
                                                  ProjFactory fac,
                                                  java.lang.String origin)
        Plugins can register additional base projections.
        Parameters:
        id - The "official" PROJ.4 id. In case the projection is not supported by PROJ.4, use some prefix, e.g. josm:myproj or gdal:otherproj.
        fac - The base projection factory.
        origin - Multiple plugins may implement the same base projection. Provide plugin name or similar string, so it be differentiated.
      • registerBaseProjection

        public static void registerBaseProjection​(java.lang.String id,
                                                  java.lang.Class<? extends Proj> projClass,
                                                  java.lang.String origin)
        Plugins can register additional base projections.
        Parameters:
        id - The "official" PROJ.4 id. In case the projection is not supported by PROJ.4, use some prefix, e.g. josm:myproj or gdal:otherproj.
        projClass - The base projection class.
        origin - Multiple plugins may implement the same base projection. Provide plugin name or similar string, so it be differentiated.
      • registerProjectionSupplier

        public static void registerProjectionSupplier​(java.lang.String code,
                                                      java.util.function.Supplier<Projection> supplier)
        Register a projection supplier, that is, a factory class for projections.
        Parameters:
        code - the code of the projection that will be returned
        supplier - a supplier to return a projection with given code
        Since:
        12786
      • getBaseProjection

        public static Proj getBaseProjection​(java.lang.String id)
        Get a base projection by id.
        Parameters:
        id - the id, for example "lonlat" or "tmerc"
        Returns:
        the corresponding base projection if the id is known, null otherwise
      • getEllipsoid

        public static Ellipsoid getEllipsoid​(java.lang.String id)
        Get an ellipsoid by id.
        Parameters:
        id - the id, for example "bessel" or "WGS84"
        Returns:
        the corresponding ellipsoid if the id is known, null otherwise
      • getDatum

        public static Datum getDatum​(java.lang.String id)
        Get a geodetic datum by id.
        Parameters:
        id - the id, for example "potsdam" or "WGS84"
        Returns:
        the corresponding datum if the id is known, null otherwise
      • getNTV2Grid

        public static NTV2GridShiftFileWrapper getNTV2Grid​(java.lang.String id)
        Get a NTV2 grid database by id.
        Parameters:
        id - the id
        Returns:
        the corresponding NTV2 grid if the id is known, null otherwise
      • getInit

        public static java.lang.String getInit​(java.lang.String code)
        Get the projection definition string for the given code.
        Parameters:
        code - the code
        Returns:
        the string that can be processed by CustomProjection. Null, if the code isn't supported.
      • loadProjectionDefinitions

        public static java.util.List<Projections.ProjectionDefinitionloadProjectionDefinitions​(java.lang.String path)
                                                                                          throws java.io.IOException
        Load projection definitions from file.
        Parameters:
        path - the path
        Returns:
        projection definitions
        Throws:
        java.io.IOException - in case of I/O error
      • loadProjectionDefinitions

        public static java.util.List<Projections.ProjectionDefinitionloadProjectionDefinitions​(java.io.BufferedReader r)
                                                                                          throws java.io.IOException
        Load projection definitions from file.
        Parameters:
        r - the reader
        Returns:
        projection definitions
        Throws:
        java.io.IOException - in case of I/O error
      • getProjectionByCode

        public static Projection getProjectionByCode​(java.lang.String code)
        Get a projection by code.
        Parameters:
        code - the code, e.g. "EPSG:2026"
        Returns:
        the corresponding projection, if the code is known, null otherwise
      • listKeys

        private static java.lang.String listKeys​(java.util.Map<java.lang.String,​?> map)
      • listProjs

        public static java.lang.String listProjs()
        Replies the list of projections as string (comma separated).
        Returns:
        the list of projections as string (comma separated)
        Since:
        8533
      • listEllipsoids

        public static java.lang.String listEllipsoids()
        Replies the list of ellipsoids as string (comma separated).
        Returns:
        the list of ellipsoids as string (comma separated)
        Since:
        8533
      • listDatums

        public static java.lang.String listDatums()
        Replies the list of datums as string (comma separated).
        Returns:
        the list of datums as string (comma separated)
        Since:
        8533
      • listNadgrids

        public static java.lang.String listNadgrids()
        Replies the list of nadgrids as string (comma separated).
        Returns:
        the list of nadgrids as string (comma separated)
        Since:
        8533