Class GeoUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Rectangle
computePolygonExtent
(org.locationtech.jts.geom.Polygon polygon) Calculates the polygon extent (the rectangle which contains all the points of the polygon)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.static org.locationtech.jts.geom.Polygon
projectPolygonToGeocoding
(org.locationtech.jts.geom.Polygon polygon, GeoCoding polygonGeoCoding, GeoCoding geoCoding) Projects the polygon from its geocoding to the target geocodingstatic org.locationtech.jts.geom.Polygon
projectPolygonToImage
(org.locationtech.jts.geom.Polygon polygon, GeoCoding geoCoding) Projects the polygon from geo coordinates (Lat,Lon) to pixel coordinates (X,Y) using its geocoding
-
Constructor Details
-
GeoUtils
public GeoUtils()
-
-
Method Details
-
createGeoBoundary
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
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:
-
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
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:
-
createGeoBoundaryPaths
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:
-
createGeoBoundaryPaths
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:
-
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:
-
createPixelBoundary
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
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
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
-
computeGeometryUsingPixelRegion
-
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) -
projectPolygonToGeocoding
public static org.locationtech.jts.geom.Polygon projectPolygonToGeocoding(org.locationtech.jts.geom.Polygon polygon, GeoCoding polygonGeoCoding, GeoCoding geoCoding) Projects the polygon from its geocoding to the target geocoding- Parameters:
polygon
- the polygon in pixel coordinates (X,Y)polygonGeoCoding
- the polygon geocodinggeoCoding
- the target geocoding- Returns:
- the polygon in pixel coordinates (X,Y), projected to the target geocoding
-
projectPolygonToImage
public static org.locationtech.jts.geom.Polygon projectPolygonToImage(org.locationtech.jts.geom.Polygon polygon, GeoCoding geoCoding) Projects the polygon from geo coordinates (Lat,Lon) to pixel coordinates (X,Y) using its geocoding- Parameters:
polygon
- the polygon with geo coordinates (Lat,Lon)geoCoding
- the polygon geocoding- Returns:
- the polygon with pixel coordinates (X,Y)
-
computePolygonExtent
Calculates the polygon extent (the rectangle which contains all the points of the polygon)- Parameters:
polygon
- the polygon to which the extent will be calculated- Returns:
- the polygon extent (the rectangle which contains all the points of the polygon)
-