Class HorizCoordSys

  • Direct Known Subclasses:
    HorizCoordSys2D

    @Immutable
    public class HorizCoordSys
    extends Object
    Horizontal CoordSys

    1) has x,y,proj (1D) isProjection 2) lat,lon (1D) isLatLon1D 3) lat,lon (2D) class HorizCoordSys2D 4) has x,y,proj and lat,lon (2D) LOOK 2D not used ?

    Must be exactly one in a CoverageDataset.

    Since:
    7/11/2015
    • Method Detail

      • getName

        public String getName()
      • isProjection

        public boolean isProjection()
      • isLatLon2D

        public boolean isLatLon2D()
      • getLatLon

        public LatLonPoint getLatLon​(int yindex,
                                     int xindex)
      • calcProjectionBoundingBox

        public ProjectionRect calcProjectionBoundingBox()
        Calculates the bounding box of this coordinate reference system, in projection coordinates. If this CRS isn't a projection, than null is returned.
        Returns:
        the bounding box of this CRS, in projection coordinates.
      • calcLatLonBoundingBox

        public LatLonRect calcLatLonBoundingBox()
        Calculates the bounding box of this coordinate reference system, in latitude/longitude. This method properly handles coverages that straddle the international date line by deriving its bounding box from the connected latitude/longitude boundary.

        If this CRS is a projection, its lat/lon boundary is computed by converting each point in its projection boundary to latitude/longitude using the projection.

        Returns:
        the bounding box of this CRS, in latitude/longitude.
      • calcConnectedLatLonBoundaryPoints

        public List<LatLonPointNoNormalize> calcConnectedLatLonBoundaryPoints​(int maxPointsInYEdge,
                                                                              int maxPointsInXEdge)
        Calculates the latitude/longitude boundary of this coordinate reference system. The boundary starts at the lower left corner of the coverage--i.e. (y[0], x[0])--and consists of the points that lie along the bottom, right, top, and left edges, in that order.

        The maxPointsInYEdge parameter establishes a limit on the number of boundary points that'll be included from the right and left edges. maxPointsInXEdge establishes a similar limit for the bottom and top edges. The size of the returned list will be ≤ 2 * maxPointsInYEdge + 2 * maxPointsInXEdge. Note that the corners are always included, regardless of the arguments. If you wish to include ALL of the points along the edges in the boundary, simply choose values for the parameters that are greater than the lengths of the corresponding axes in the CRS. Integer.MAX_VALUE works great. In that case, the size of the returned list will be 2 * numXcoords + 2 * numYcoords.

        If this CRS is a projection, the lat/lon boundary is computed by converting each point in its projection boundary to latitude/longitude using the projection.

        Points in the boundary will be connected. This facilitates proper interpretation of the boundary if it's rendered as a georeferenced polygon, particularly when the boundary crosses the international date line.

        Parameters:
        maxPointsInYEdge - the maximum number of boundary points to include from the right and left edges.
        maxPointsInXEdge - the maximum number of boundary points to include from the bottom and top edges.
        Returns:
        the connected latitude/longitude boundary of this CRS.
      • calcProjectionBoundaryPoints

        public List<ProjectionPoint> calcProjectionBoundaryPoints​(int maxPointsInYEdge,
                                                                  int maxPointsInXEdge)
        Calculates the boundary of this coordinate reference system, in projection coordinates. The boundary starts at the lower left corner of the coverage--i.e. (y[0], x[0])--and consists of the points that lie along the bottom, right, top, and left edges, in that order.

        The maxPointsInYEdge parameter establishes a limit on the number of boundary points that'll be included from the right and left edges. maxPointsInXEdge establishes a similar limit for the bottom and top edges. The size of the returned list will be ≤ 2 * maxPointsInYEdge + 2 * maxPointsInXEdge. Note that the corners are always included, regardless of the arguments. If you wish to include ALL of the points along the edges in the boundary, simply choose values for the parameters that are greater than the lengths of the corresponding axes in the CRS. Integer.MAX_VALUE works great. In that case, the size of the returned list will be 2 * numXcoords + 2 * numYcoords.

        Parameters:
        maxPointsInYEdge - the maximum number of boundary points to include from the right and left edges.
        maxPointsInXEdge - the maximum number of boundary points to include from the bottom and top edges.
        Returns:
        the boundary of this coordinate reference system, in projection coordinates.
        Throws:
        UnsupportedOperationException - if this CRS is not a projection.
      • connectLatLonPoints

        public static List<LatLonPointNoNormalize> connectLatLonPoints​(List<LatLonPoint> points)
        Returns a list of points that is equivalent to the input list, but with longitude values adjusted to ensure that adjacent elements are "connected".

        Two points are "connected" if the absolute difference of their normalized longitudes is ≤180. For example, the longitudes 112 and 124 are connected. So are 15 and -27.

        Two points may be "disconnected" if they lie on opposite sides of the international date line. For example, the longitudes 175 and -175 are disconnected because their absolute difference is 350, which is >180. To connect the two points, we adjust the second longitude to an equivalent value in the range [firstLon ± 180] by adding or subtracting 360. So, -175 would become 185. We perform this adjustment for each pair of adjacent elements in the list.

        Performing the above adjustment will result in longitudes that lie outside of the normalized range of ([-180, 180]). To be precise, if adjustments are necessary, all of the longitudes in the returned list will be in either [-360, 0] or [0, 360]. Consequently, adjusted points cannot be returned as LatLonPoints; they are returned as LatLonPointNoNormalize objects instead.

        Longitudes lon1 and lon2 are considered equivalent if lon1 == lon2 + 360 * i, for some integer i.

        Parameters:
        points - a sequence of normalized lat/lon points that potentially crosses the international date line.
        Returns:
        an equivalent sequence of points that has been adjusted to be "connected".
      • getLatLonBoundaryAsWKT

        public String getLatLonBoundaryAsWKT()
        Calls getLatLonBoundaryAsWKT(int, int) with Integer.MAX_VALUE as both arguments. In effect, the boundary will contain ALL of the points along the edges of the CRS.
        Returns:
        the latitude/longitude boundary of this CRS as a polygon in WKT.
      • getLatLonBoundaryAsWKT

        public String getLatLonBoundaryAsWKT​(int maxPointsInYEdge,
                                             int maxPointsInXEdge)
        Returns the latitude/longitude boundary of this coordinate reference system as a polygon in WKT. It is used in the OpenLayers map in NCSS, as well as the "datasetBoundaries" endpoint.
        Parameters:
        maxPointsInYEdge - the maximum number of boundary points to include from the right and left edges.
        maxPointsInXEdge - the maximum number of boundary points to include from the bottom and top edges.
        Returns:
        the latitude/longitude boundary of this CRS as a polygon in WKT.
      • getLatLonBoundaryAsGeoJSON

        public String getLatLonBoundaryAsGeoJSON()
        Calls getLatLonBoundaryAsGeoJSON(int, int) with Integer.MAX_VALUE as both arguments. In effect, the boundary will contain ALL of the points along the edges of the CRS.
        Returns:
        the latitude/longitude boundary of this CRS as a polygon in GeoJSON.
      • getLatLonBoundaryAsGeoJSON

        public String getLatLonBoundaryAsGeoJSON​(int maxPointsInYEdge,
                                                 int maxPointsInXEdge)
        Similar to getLatLonBoundaryAsWKT(), but returns a GeoJSON polygon instead.