Skip to content

Commit

Permalink
wmf.Save_Array2Raster: now it takes into account the differences in t…
Browse files Browse the repository at this point in the history
…he size of the pixel at X and Y
  • Loading branch information
nicolas998 committed Jan 30, 2020
1 parent 78a1c0d commit 84793f1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions wmf/wmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,10 @@ def Save_Array2Raster(Array, ArrayProp, ruta, EPSG = 4326, Format = 'GTiff'):
#Formato de condiciones del mapa
x_pixels = Array.shape[0] # number of pixels in x
y_pixels = Array.shape[1] # number of pixels in y
PIXEL_SIZE = ArrayProp[4] # size of the pixel...
PIXEL_SIZE_x = ArrayProp[4] # size of the pixel...
PIXEL_SIZE_y = ArrayProp[5] # size of the pixel...
x_min = ArrayProp[2]
y_max = ArrayProp[3] + ArrayProp[4] * ArrayProp[1] # x_min & y_max are like the "top left" corner.
y_max = ArrayProp[3] + ArrayProp[5] * ArrayProp[1] # x_min & y_max are like the "top left" corner.
driver = gdal.GetDriverByName(Format)
#Para encontrar el formato de GDAL
NP2GDAL_CONVERSION = {
Expand All @@ -392,11 +393,11 @@ def Save_Array2Raster(Array, ArrayProp, ruta, EPSG = 4326, Format = 'GTiff'):
#coloca la referencia espacial
dataset.SetGeoTransform((
x_min, # 0
PIXEL_SIZE, # 1
PIXEL_SIZE_x, # 1
0, # 2
y_max, # 3
0, # 4
-PIXEL_SIZE))
-PIXEL_SIZE_y))
#coloca la proyeccion a partir de un EPSG
proj = osgeo.osr.SpatialReference()
texto = 'EPSG:' + str(EPSG)
Expand Down

0 comments on commit 84793f1

Please sign in to comment.