Commit 7537b5eb authored by Cresson Remi's avatar Cresson Remi
Browse files

ADD: get_bbox_wgs84_from_raster()

1 merge request!19ADD: BoundinBox class
Showing with 13 additions and 2 deletions
+13 -2
......@@ -99,7 +99,7 @@ def get_bbox_wgs84_from_gdal_ds(gdal_ds):
"""
Returns the bounding box in WGS84 CRS from a GDAL dataset
:param gdal_ds: GDAL dataset
:return: bounding box (xmin, xmax, ymin, ymax)
:return: bounding box in WGS84 CRS (BoundingBox instance)
"""
extend_wgs84 = get_extent_wgs84(gdal_ds)
......@@ -193,7 +193,7 @@ def get_bbox_wgs84_from_vector(vector_file):
"""
Returns the bounding box in WGS84 CRS from a vector data
:param vector_file: vector data filename
:return: bounding box in WGS84 CRS
:return: bounding box in WGS84 CRS (BoundingBox instance)
"""
poly_ds = open_vector_layer(vector_file=vector_file)
poly_layer = poly_ds.GetLayer()
......@@ -207,6 +207,17 @@ def get_bbox_wgs84_from_vector(vector_file):
return BoundingBox(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)
def get_bbox_wgs84_from_raster(raster_file):
"""
Returns the bounding box in WGS84 CRS from a raster
:param raster_file: raster file
:return: bounding box in WGS84 CRS (BoundingBox instance)
"""
gdal_ds = gdal.open(raster_file)
return get_bbox_wgs84_from_gdal_ds(gdal_ds=gdal_ds)
def find_files_in_all_subdirs(pth, pattern, case_sensitive=True):
"""
Returns the list of files matching the pattern in all subdirectories of pth
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment