Class CustomProjection

    • Field Detail

      • UNITS_TO_METERS

        private static final java.util.Map<java.lang.String,​java.lang.Double> UNITS_TO_METERS
      • PRIME_MERIDANS

        private static final java.util.Map<java.lang.String,​java.lang.Double> PRIME_MERIDANS
      • pref

        protected java.lang.String pref
        pref String that defines the projection

        null means fall back mode (Mercator)

      • name

        protected java.lang.String name
      • code

        protected java.lang.String code
      • axis

        private java.lang.String axis
        Starting in PROJ 4.8.0, the +axis argument can be used to control the axis orientation of the coordinate system. The default orientation is "easting, northing, up" but directions can be flipped, or axes flipped using combinations of the axes in the +axis switch. The values are: e (Easting), w (Westing), n (Northing), s (Southing), u (Up), d (Down); Examples: +axis=enu (the default easting, northing, elevation), +axis=neu (northing, easting, up; useful for "lat/long" geographic coordinates, or south orientated transverse mercator), +axis=wnu (westing, northing, up - some planetary coordinate systems have "west positive" coordinate systems)

        See proj4.org

      • LON_LAT_VALUES

        private static final java.util.List<java.lang.String> LON_LAT_VALUES
    • Constructor Detail

      • CustomProjection

        public CustomProjection()
        Constructs a new empty CustomProjection.
      • CustomProjection

        public CustomProjection​(java.lang.String pref)
        Constructs a new CustomProjection with given parameters.
        Parameters:
        pref - String containing projection parameters (ex: "+proj=tmerc +lon_0=-3 +k_0=0.9996 +x_0=500000 +ellps=WGS84 +datum=WGS84 +bounds=-8,-5,2,85")
      • CustomProjection

        public CustomProjection​(java.lang.String name,
                                java.lang.String code,
                                java.lang.String pref)
        Constructs a new CustomProjection with given name, code and parameters.
        Parameters:
        name - describe projection in one or two words
        code - unique code for this projection - may be null
        pref - the string that defines the custom projection
    • Method Detail

      • update

        public final void update​(java.lang.String pref)
                          throws ProjectionConfigurationException
        Updates this CustomProjection with given parameters.
        Parameters:
        pref - String containing projection parameters (ex: "+proj=lonlat +ellps=WGS84 +datum=WGS84 +bounds=-180,-90,180,90")
        Throws:
        ProjectionConfigurationException - if pref cannot be parsed properly
      • parseParameterList

        public static java.util.Map<java.lang.String,​java.lang.String> parseParameterList​(java.lang.String pref,
                                                                                                boolean ignoreUnknownParameter)
                                                                                         throws ProjectionConfigurationException
        Parse a parameter list to key=value pairs.
        Parameters:
        pref - the parameter list
        ignoreUnknownParameter - true, if unknown parameter should not raise exception
        Returns:
        parameters map
        Throws:
        ProjectionConfigurationException - in case of invalid parameter
      • resolveInits

        public static java.util.Map<java.lang.String,​java.lang.String> resolveInits​(java.util.Map<java.lang.String,​java.lang.String> parameters,
                                                                                          boolean ignoreUnknownParameter)
                                                                                   throws ProjectionConfigurationException
        Recursive resolution of +init includes.
        Parameters:
        parameters - parameters map
        ignoreUnknownParameter - true, if unknown parameter should not raise exception
        Returns:
        parameters map with +init includes resolved
        Throws:
        ProjectionConfigurationException - in case of invalid parameter
      • parseAngle

        public static double parseAngle​(java.lang.String angleStr,
                                        java.lang.String parameterName)
                                 throws ProjectionConfigurationException
        Convert an angle string to a double value
        Parameters:
        angleStr - The string. e.g. -1.1 or 50d10'3"
        parameterName - Only for error message.
        Returns:
        The angle value, in degrees.
        Throws:
        ProjectionConfigurationException - in case of invalid parameter
      • toCode

        public java.lang.String toCode()
        Description copied from class: AbstractProjection
        Default implementation of toCode(). Should be overridden, if there is no EPSG code for this CRS.
        Specified by:
        toCode in interface Projection
        Overrides:
        toCode in class AbstractProjection
        Returns:
        the projection identifier
      • getWorldBoundsLatLon

        public Bounds getWorldBoundsLatLon()
        Description copied from interface: Projection
        Get the bounds of the world.
        Returns:
        the supported lat/lon rectangle for this projection
      • toString

        public java.lang.String toString()
        Description copied from interface: Projection
        Describe the projection in one or two words.
        Specified by:
        toString in interface Projection
        Overrides:
        toString in class java.lang.Object
        Returns:
        the name / description
      • getMetersPerUnit

        public double getMetersPerUnit()
        Factor to convert units of east/north coordinates to meters. When east/north coordinates are in degrees (geographic CRS), the scale at the equator is taken, i.e. 360 degrees corresponds to the length of the equator in meters.
        Returns:
        factor to convert units to meter
      • switchXY

        public boolean switchXY()
        Description copied from interface: Projection
        Does this projection natural order of coordinates is North East, instead of East North
        Returns:
        true if natural order of coordinates is North East, false if East North
      • getUnitsToMeters

        private static java.util.Map<java.lang.String,​java.lang.Double> getUnitsToMeters()
      • getPrimeMeridians

        private static java.util.Map<java.lang.String,​java.lang.Double> getPrimeMeridians()
      • getLatLonBoundsBox

        public Bounds getLatLonBoundsBox​(ProjectionBounds r)
        Description copied from interface: Projection
        Find lat/lon-box containing all the area of a given rectangle in east/north space. This is an approximate method. Points outside of the world should be ignored.
        Parameters:
        r - the rectangle in projected space
        Returns:
        minimum lat/lon box, that when projected, covers pb
      • getEastNorthBoundsBox

        public ProjectionBounds getEastNorthBoundsBox​(ProjectionBounds box,
                                                      Projection boxProjection)
        Description copied from interface: Projection
        Get a box in east/north space of this projection, that fully contains an east/north box of another projection. Reprojecting a rectangular box from one projection to another may distort/rotate the shape of the box, so in general one needs to walk along the boundary in small steps to get a reliable result. This is an approximate method.
        Parameters:
        box - the east/north box given in projection boxProjection
        boxProjection - the projection of box
        Returns:
        an east/north box in this projection, containing the given box
      • isGeographic

        public boolean isGeographic()
        Return true, if a geographic coordinate reference system is represented.

        I.e. if it returns latitude/longitude values rather than Cartesian east/north coordinates on a flat surface.

        Returns:
        true, if it is geographic
        Since:
        12792