Class GeoUtils


  • public class GeoUtils
    extends Object
    • Constructor Detail

      • GeoUtils

        public GeoUtils()
    • Method Detail

      • createGeoBoundary

        public static GeoPos[] createGeoBoundary​(Product product,
                                                 int step)
        Creates the geographical boundary of the given product and returns it as a list of geographical coordinates.
        Parameters:
        product - the input product, must not be null
        step - the step given in pixels
        Returns:
        an array of geographical coordinates
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
      • createGeoBoundary

        public static GeoPos[] createGeoBoundary​(Product product,
                                                 Rectangle region,
                                                 int step,
                                                 boolean usePixelCenter)
        Creates the geographical boundary of the given region within the given product and returns it as a list of geographical coordinates.
        Parameters:
        product - the input product, must not be null
        region - the region rectangle in product pixel coordinates, can be null for entire product
        step - the step given in pixels
        usePixelCenter - true if the pixel center should be used to create the boundary
        Returns:
        an array of geographical coordinates
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
      • createGeoBoundary

        public static GeoPos[] createGeoBoundary​(RasterDataNode raster,
                                                 Rectangle region,
                                                 int step)
        Creates the geographical boundary of the given region within the given raster and returns it as a list of geographical coordinates.
        Parameters:
        raster - the input raster, must not be null
        region - the region rectangle in raster pixel coordinates, can be null for entire raster
        step - the step given in pixels
        Returns:
        an array of geographical coordinates
        Throws:
        IllegalArgumentException - if raster is null or if the raster has no GeoCoding is null
        See Also:
        createPixelBoundary(RasterDataNode, java.awt.Rectangle, int)
      • createGeoBoundary

        public static GeoPos[] createGeoBoundary​(RasterDataNode rasterDataNode,
                                                 Rectangle region,
                                                 int step,
                                                 boolean usePixelCenter)
        Creates the geographical boundary of the given region within the given RasterDataNode and returns it as a list of geographical coordinates.
        Parameters:
        rasterDataNode - the input rasterDataNode, must not be null
        region - the region rectangle in product pixel coordinates, can be null for entire product
        step - the step given in pixels
        usePixelCenter - true if the pixel center should be used to create the boundary
        Returns:
        an array of geographical coordinates
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
      • createGeoBoundaryPaths

        public static GeneralPath[] createGeoBoundaryPaths​(Product product)
        Converts the geographic boundary entire product into one, two or three shape objects. If the product does not intersect the 180 degree meridian, a single general path is returned. Otherwise two or three shapes are created and returned in the order from west to east.

        The geographic boundary of the given product are returned as shapes comprising (longitude,latitude) pairs.

        Parameters:
        product - the input product
        Returns:
        an array of shape objects
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
        See Also:
        createGeoBoundary(Product, int)
      • createGeoBoundaryPaths

        public static GeneralPath[] createGeoBoundaryPaths​(RasterDataNode rasterDataNode)
        Converts the geographic boundary entire raster data node into one, two or three shape objects. If the data does not intersect the 180 degree meridian, a single general path is returned. Otherwise two or three shapes are created and returned in the order from west to east.

        The geographic boundary of the given raster data node are returned as shapes comprising (longitude,latitude) pairs.

        Parameters:
        rasterDataNode - the input raster data node
        Returns:
        an array of shape objects
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
        See Also:
        createGeoBoundary(Product, int)
      • createGeoBoundaryPaths

        public static GeneralPath[] createGeoBoundaryPaths​(Product product,
                                                           Rectangle region,
                                                           int step)
        Converts the geographic boundary of the region within the given product into one, two or three shape objects. If the product does not intersect the 180 degree meridian, a single general path is returned. Otherwise two or three shapes are created and returned in the order from west to east.

        This method delegates to createGeoBoundaryPaths(Product, Rectangle, int, boolean) and the additional parameter usePixelCenter is true.

        The geographic boundary of the given product are returned as shapes comprising (longitude,latitude) pairs.

        Parameters:
        product - the input product
        region - the region rectangle in product pixel coordinates, can be null for entire product
        step - the step given in pixels
        Returns:
        an array of shape objects
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
      • createGeoBoundaryPaths

        public static GeneralPath[] createGeoBoundaryPaths​(Product product,
                                                           Rectangle region,
                                                           int step,
                                                           boolean usePixelCenter)
        Converts the geographic boundary of the region within the given product into one, two or three shape objects. If the product does not intersect the 180 degree meridian, a single general path is returned. Otherwise two or three shapes are created and returned in the order from west to east.

        The geographic boundary of the given product are returned as shapes comprising (longitude,latitude) pairs.

        Parameters:
        product - the input product
        region - the region rectangle in product pixel coordinates, can be null for entire product
        step - the step given in pixels
        usePixelCenter - true if the pixel center should be used to create the pathes
        Returns:
        an array of shape objects
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
        See Also:
        createGeoBoundary(Product, java.awt.Rectangle, int, boolean)
      • createGeoBoundaryPaths

        public static GeneralPath[] createGeoBoundaryPaths​(RasterDataNode rasterDataNode,
                                                           Rectangle region,
                                                           int step,
                                                           boolean usePixelCenter)
        Converts the geographic boundary of the region within the given rastrer data node into one, two or three shape objects. If the data node does not intersect the 180 degree meridian, a single general path is returned. Otherwise two or three shapes are created and returned in the order from west to east.

        The geographic boundary of the given raster data node are returned as shapes comprising (longitude,latitude) pairs.

        Parameters:
        rasterDataNode - the input raster data node
        region - the region rectangle in product pixel coordinates, can be null for entire product
        step - the step given in pixels
        usePixelCenter - true if the pixel center should be used to create the pathes
        Returns:
        an array of shape objects
        Throws:
        IllegalArgumentException - if product is null or if the product's GeoCoding is null
        See Also:
        createGeoBoundary(Product, java.awt.Rectangle, int, boolean)
      • createPixelBoundary

        public static PixelPos[] createPixelBoundary​(RasterDataNode raster,
                                                     Rectangle rect,
                                                     int step)
        Creates a rectangular boundary expressed in pixel positions for the given source rectangle. If the source rect is 100 x 50 pixels and step is 10 the returned array will countain exactly 2 * 10 + 2 * (5 - 2) = 26 pixel positions.

        This method is used for an intermediate step when determining a raster boundary expressed in geographical co-ordinates.

        Parameters:
        raster - the raster
        rect - the source rectangle
        step - the mean distance from one pixel position to the other in the returned array
        Returns:
        the rectangular boundary
      • createPixelBoundary

        public static PixelPos[] createPixelBoundary​(int rasterWidth,
                                                     int rasterHeight,
                                                     Rectangle rect,
                                                     int step)
        Creates a rectangular boundary expressed in pixel positions for the given source rectangle. If the source rect is 100 x 50 pixels and step is 10 the returned array will contain exactly 2 * 10 + 2 * (5 - 2) = 26 pixel positions.

        This method is used for an intermediate step when determining a raster boundary expressed in geographical co-ordinates.

        Parameters:
        rasterWidth - the raster width in pixels
        rasterHeight - the raster height in pixels
        rect - the source rectangle
        step - the mean distance from one pixel position to the other in the returned array
        Returns:
        the rectangular boundary
      • createPixelBoundaryFromRect

        public static PixelPos[] createPixelBoundaryFromRect​(Rectangle rect,
                                                             int step)
        Creates a rectangular boundary expressed in pixel positions for the given source rectangle. If the source rect is 100 x 50 pixels and step is 10 the returned array will contain exactly 2 * 10 + 2 * (5 - 2) = 26 pixel positions.

        This method is used for an intermediate step when determining a product boundary expressed in geographical co-ordinates.

        This method delegates to createPixelBoundaryFromRect(Rectangle, int, boolean) and the additional boolean parameter usePixelCenter is true.

        Parameters:
        rect - the source rectangle
        step - the mean distance from one pixel position to the other in the returned array
        Returns:
        the rectangular boundary
      • createPixelBoundaryFromRect

        public static PixelPos[] createPixelBoundaryFromRect​(Rectangle rect,
                                                             int step,
                                                             boolean usePixelCenter)
        Creates a rectangular boundary expressed in pixel positions for the given source rectangle. If the source rect is 100 x 50 pixels and step is 10 the returned array will countain exactly 2 * 10 + 2 * (5 - 2) = 26 pixel positions.

        This method is used for an intermediate step when determining a product boundary expressed in geographical co-ordinates.

        Parameters:
        rect - the source rectangle
        step - the mean distance from one pixel position to the other in the returned array
        usePixelCenter - true if the pixel center should be used
        Returns:
        the rectangular boundary
      • areaToSubPaths

        public static List<GeneralPath> areaToSubPaths​(Area area,
                                                       double deltaX)
        Turns an area into one or multiple paths.
        Parameters:
        area - the area to convert
        deltaX - the value is used to translate the x-cordinates
        Returns:
        the list of paths
      • computePixelRegionUsingGeometry

        public static Rectangle computePixelRegionUsingGeometry​(GeoCoding rasterGeoCoding,
                                                                int rasterWidth,
                                                                int rasterHeight,
                                                                org.locationtech.jts.geom.Geometry geometryRegion,
                                                                int numBorderPixels,
                                                                boolean roundPixelRegion,
                                                                boolean multiSize)
      • computeGeometryUsingPixelRegion

        public static org.locationtech.jts.geom.Geometry computeGeometryUsingPixelRegion​(GeoCoding rasterGeoCoding,
                                                                                         Rectangle pixelRegion)
      • computeRasterGeometry

        public static org.locationtech.jts.geom.Geometry computeRasterGeometry​(GeoCoding rasterGeoCoding,
                                                                               int rasterWidth,
                                                                               int rasterHeight)
      • computeRasterGeometry

        public static org.locationtech.jts.geom.Geometry computeRasterGeometry​(GeoCoding rasterGeoCoding,
                                                                               int rasterWidth,
                                                                               int rasterHeight,
                                                                               boolean usePixelCenter,
                                                                               boolean multiSize)