Commit 3569cdd5 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

wkt raster

parent e2e2351d
...@@ -125,13 +125,15 @@ def rasterWkt(wkt, inputfile, outputfile): ...@@ -125,13 +125,15 @@ def rasterWkt(wkt, inputfile, outputfile):
np_polygon = getPolygonArray(inputImage, wkt) np_polygon = getPolygonArray(inputImage, wkt)
print("Setup") print("Setup")
for b in range(1, output.RasterCount+1): for b in range(1, output.RasterCount+1):
np_input = np_polygon & inputImage.GetRasterBand(b).ReadAsArray(0,0,cols,rows) np_input = inputImage.GetRasterBand(b).ReadAsArray(0,0,cols,rows)
output.GetRasterBand(b).SetNoDataValue(-99) output.GetRasterBand(b).SetNoDataValue(-99)
output.GetRasterBand(b).WriteArray(np_input) output.GetRasterBand(b).WriteArray(np_input)
output.GetRasterBand(b).FlushCache() output.GetRasterBand(b).FlushCache()
output.SetGeoTransform(geotransform) # output.SetGeoTransform(geotransform)
output.SetProjection(sr.ExportToWkt()) # output.SetProjection(sr.ExportToWkt())
output.SetProjection(inputImage.GetProjectionRef())
output.SetGeoTransform(inputImage.GetGeoTransform())
print("end") print("end")
#Close files #Close files
......
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