Commit cc0c482d authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added function GeoArray.tiles().

parent 4f4e52a4
Pipeline #1453 failed with stages
in 1 minute and 1 second
......@@ -36,6 +36,7 @@ from py_tools_ds.geo.vector.geometry import boxObj
from import get_GDAL_ds_inmem
from py_tools_ds.compatibility.gdal import get_gdal_func
from py_tools_ds.numeric.numbers import is_number
from py_tools_ds.numeric.array import get_array_tilebounds
# internal imports
from .subsetting import get_array_at_mapPos
......@@ -692,7 +693,10 @@ class GeoArray(object):
# temp conversion to EPSG needed because GDAL seems to modify WKT string when writing file to disk
# (e.g. using gdal_merge) -> conversion to EPSG and back undos that
self._projection = EPSG2WKT(WKT2EPSG(ds.GetProjection()))
self._projection = EPSG2WKT(WKT2EPSG(ds.GetProjection()))
self._projection = None
if 'nodata' not in self._initParams or self._initParams['nodata'] is None:
band = ds.GetRasterBand(1)
......@@ -1319,6 +1323,18 @@ class GeoArray(object):
if not (self.footprint_poly.within( or self.footprint_poly.equals(
self.footprint_poly = self.footprint_poly.intersection(
def tiles(self, tilesize=(100, 100)):
:param tilesize:
bounds_alltiles = get_array_tilebounds(self.shape, tilesize)
for bounds_tile in bounds_alltiles:
(rS, rE), (cS, cE) = bounds_tile
yield bounds_tile, self[rS: rE + 1, cS: cE + 1, :]
def get_mapPos(self, mapBounds, mapBounds_prj, band2get=None, out_prj=None, arr_gt=None, arr_prj=None, fillVal=None,
rspAlg='near', progress=None, v=False): # TODO implement slice for indexing bands
# type: (tuple, str, int, str, tuple, str, int, str, bool, bool) -> (np.ndarray, tuple, str)
Markdown is supported
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