Commit e2e2351d authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

wkt raster

parent 9c40a3a1
......@@ -47,16 +47,16 @@ def getPolygonArray(image, wkt):
layer.CreateFeature(feature)
#Set up polygon raster
driverTiff = gdal.GetDriverByName('GTiff')
polygonRaster = driverTiff.Create("polygonTmp.tif", cols, rows, 1, gdal.GDT_Byte)
polygonRaster.GetRasterBand(1).SetNoDataValue(-99)
polygonRaster.GetRasterBand(1).WriteArray(np.zeros((rows, cols)))
polygonRaster.GetRasterBand(1).FlushCache()
polygonRaster.SetGeoTransform(geotransform)
polygonRaster.SetProjection(sr.ExportToWkt())
# polygonRaster.SetGeoTransform(geotransform)
# polygonRaster.SetProjection(sr.ExportToWkt())
polygonRaster.SetProjection(image.GetProjectionRef())
polygonRaster.SetGeoTransform(image.GetGeoTransform())
#Burn Polygon
gdal.RasterizeLayer(polygonRaster, [1], layer, burn_values=[255])
polygonRaster.GetRasterBand(1).FlushCache()
......
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