Class GeoUtils
- java.lang.Object
-
- org.esa.snap.core.util.GeoUtils
-
public class GeoUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description GeoUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<GeneralPath>
areaToSubPaths(Area area, double deltaX)
Turns an area into one or multiple paths.static org.locationtech.jts.geom.Geometry
computeGeometryUsingPixelRegion(GeoCoding rasterGeoCoding, Rectangle pixelRegion)
static Rectangle
computePixelRegionUsingGeometry(GeoCoding rasterGeoCoding, int rasterWidth, int rasterHeight, org.locationtech.jts.geom.Geometry geometryRegion, int numBorderPixels, boolean roundPixelRegion, boolean multiSize)
static org.locationtech.jts.geom.Geometry
computeRasterGeometry(GeoCoding rasterGeoCoding, int rasterWidth, int rasterHeight)
static org.locationtech.jts.geom.Geometry
computeRasterGeometry(GeoCoding rasterGeoCoding, int rasterWidth, int rasterHeight, boolean usePixelCenter, boolean multiSize)
static GeoPos[]
createGeoBoundary(Product product, int step)
Creates the geographical boundary of the given product and returns it as a list of geographical coordinates.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.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.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.static GeneralPath[]
createGeoBoundaryPaths(Product product)
Converts the geographic boundary entire product into one, two or three shape objects.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.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.static GeneralPath[]
createGeoBoundaryPaths(RasterDataNode rasterDataNode)
Converts the geographic boundary entire raster data node into one, two or three shape objects.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.static PixelPos[]
createPixelBoundary(int rasterWidth, int rasterHeight, Rectangle rect, int step)
Creates a rectangular boundary expressed in pixel positions for the given source rectangle.static PixelPos[]
createPixelBoundary(RasterDataNode raster, Rectangle rect, int step)
Creates a rectangular boundary expressed in pixel positions for the given source rectangle.static PixelPos[]
createPixelBoundaryFromRect(Rectangle rect, int step)
Creates a rectangular boundary expressed in pixel positions for the given source rectangle.static PixelPos[]
createPixelBoundaryFromRect(Rectangle rect, int step, boolean usePixelCenter)
Creates a rectangular boundary expressed in pixel positions for the given source rectangle.
-
-
-
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 nullstep
- the step given in pixels- Returns:
- an array of geographical coordinates
- Throws:
IllegalArgumentException
- if product is null or if the product'sGeoCoding
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 nullregion
- the region rectangle in product pixel coordinates, can be null for entire productstep
- the step given in pixelsusePixelCenter
-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'sGeoCoding
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 nullregion
- the region rectangle in raster pixel coordinates, can be null for entire rasterstep
- the step given in pixels- Returns:
- an array of geographical coordinates
- Throws:
IllegalArgumentException
- if raster is null or if the raster has noGeoCoding
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 nullregion
- the region rectangle in product pixel coordinates, can be null for entire productstep
- the step given in pixelsusePixelCenter
-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'sGeoCoding
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'sGeoCoding
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'sGeoCoding
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 parameterusePixelCenter
istrue
.The geographic boundary of the given product are returned as shapes comprising (longitude,latitude) pairs.
- Parameters:
product
- the input productregion
- the region rectangle in product pixel coordinates, can be null for entire productstep
- the step given in pixels- Returns:
- an array of shape objects
- Throws:
IllegalArgumentException
- if product is null or if the product'sGeoCoding
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 productregion
- the region rectangle in product pixel coordinates, can be null for entire productstep
- the step given in pixelsusePixelCenter
-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'sGeoCoding
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 noderegion
- the region rectangle in product pixel coordinates, can be null for entire productstep
- the step given in pixelsusePixelCenter
-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'sGeoCoding
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 sourcerect
is 100 x 50 pixels andstep
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 rasterrect
- the source rectanglestep
- 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 sourcerect
is 100 x 50 pixels andstep
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 pixelsrasterHeight
- the raster height in pixelsrect
- the source rectanglestep
- 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 sourcerect
is 100 x 50 pixels andstep
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 parameterusePixelCenter
istrue
.- Parameters:
rect
- the source rectanglestep
- 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 sourcerect
is 100 x 50 pixels andstep
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 rectanglestep
- the mean distance from one pixel position to the other in the returned arrayusePixelCenter
-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 convertdeltaX
- 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)
-
-