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

new keyword for GeoArray.get_mapPos()

io.raster.GeoArray.GeoArray:
- get_mapPos(): implemented keyword out_prj

- updated __version__
parent b677b5ff
......@@ -15,7 +15,7 @@ __all__=[#'compatibility',
'similarity',
'GeoArray']
__version__ = '20170223_01'
__version__ = '20170223_02'
__author__='Daniel Scheffler'
# Validate GDAL version
......
......@@ -632,6 +632,7 @@ class GeoArray(object):
:return:
"""
# TODO add support for global domain metadata
if not self._gdalDataset_meta_already_set:
assert self.filePath
ds = gdal.Open(self.filePath)
......@@ -644,7 +645,7 @@ class GeoArray(object):
band = ds.GetRasterBand(1)
self._nodata = band.GetNoDataValue() # FIXME this does not support different nodata values within the same file
# read metadata
# read band domain metadata
for b in range(self.bands):
band = ds.GetRasterBand(b+1)
self.metadata[b] = GeoSeries(band.GetMetadata())
......@@ -1102,7 +1103,7 @@ class GeoArray(object):
return m
def get_mapPos(self, mapBounds, mapBounds_prj, band2get=None, arr_gt=None, arr_prj=None, fillVal=None,
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, tuple, str, int, str, bool, bool) -> (np.ndarray, tuple, str)
"""Returns the array data of GeoArray at a given geographic position.
......@@ -1113,6 +1114,7 @@ class GeoArray(object):
:param mapBounds: xmin, ymin, xmax, ymax
:param mapBounds_prj: WKT projection string corresponding to mapBounds
:param band2get: band index of the band to be returned (full array if not given)
:param out_prj: output projection as WKT string. If not given, the self.projection is used.
:param arr_gt: GDAL GeoTransform (taken from self if not given)
:param arr_prj: WKT projection string (taken from self if not given)
:param fillVal: nodata value
......@@ -1125,6 +1127,7 @@ class GeoArray(object):
arr_gt = arr_gt if arr_gt else self.geotransform
arr_prj = arr_prj if arr_prj else self.projection
out_prj = out_prj if out_prj else arr_prj
fillVal = fillVal if fillVal is not None else self.nodata
progress = progress if progress is not None else self.progress
......@@ -1141,7 +1144,7 @@ class GeoArray(object):
print('\tfillVal', fillVal, self.nodata, '\n')
sub_arr, sub_gt, sub_prj = get_array_at_mapPos(self, arr_gt, arr_prj,
out_prj = arr_prj,
out_prj = out_prj,
mapBounds = mapBounds,
mapBounds_prj = mapBounds_prj,
fillVal = fillVal,
......
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