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


- GeoArray.get_mapPos(): bugfix in case mapBounds are not given in projection of GeoArray
- get_array_at_mapPos(): bugfix for wrong handling of mapBounds in case they are not provided in the projection of GeoArray

- updated __version__
parent bfba873a
......@@ -15,7 +15,7 @@ __all__=[#'compatibility',
__version__ = '20170125_01'
__version__ = '20170201_01'
__author__='Daniel Scheffler'
# Validate GDAL version
......@@ -1140,9 +1140,15 @@ class GeoArray(object):
print('\tarr_prj', WKT2EPSG(arr_prj), self.epsg)
print('\tfillVal', fillVal, self.nodata, '\n')
sub_arr, sub_gt, sub_prj = get_array_at_mapPos(self, arr_gt, arr_prj, mapBounds_prj, mapBounds, fillVal=fillVal,
rspAlg=rspAlg, out_gsd=(self.xgsd,self.ygsd), band2get=band2get,
sub_arr, sub_gt, sub_prj = get_array_at_mapPos(self, arr_gt, arr_prj,
out_prj = arr_prj,
mapBounds = mapBounds,
mapBounds_prj = mapBounds_prj,
fillVal = fillVal,
rspAlg = rspAlg,
out_gsd = (self.xgsd,self.ygsd),
band2get = band2get,
progress = progress)
return sub_arr, sub_gt, sub_prj
......@@ -1578,10 +1584,21 @@ def get_array_at_mapPos(arr, arr_gt, arr_prj, out_prj, mapBounds, mapBounds_prj=
samePrj = prj_equal(arr_prj, out_prj)
if samePrj:
# output array is requested in the same projection like input array => no reprojection needed
# mapBounds are expected to have the same projection like the input array
if not prj_equal(arr_prj, mapBounds_prj):
xmin, ymin, xmax, ymax = mapBounds
(xmin, ymin), (xmax, ymax) = \
[transform_any_prj(mapBounds_prj, arr_prj, X, Y) for X,Y in [(xmin, ymin), (xmax, ymax)]]
mapBounds = xmin, ymin, xmax, ymax
out_prj = arr_prj
out_arr, out_gt = _clip_array_at_mapPos(arr, mapBounds, arr_gt, band2clip=band2get, fillVal=fillVal)
# output array is requested in another projection => reprojection needed
# calculate requested geo bounds in the target projection, snapped to the output array grid
mapBounds = snap_bounds_to_pixGrid(mapBounds, arr_gt)
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