Commit 969b925e authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

drawing polygon

parent 31889f26
...@@ -49,7 +49,8 @@ def rasterWkt(wkt, inputfile, outputfile): ...@@ -49,7 +49,8 @@ def rasterWkt(wkt, inputfile, outputfile):
polygonRaster.GetRasterBand(1).WriteArray(np.zeros((rows, cols))) polygonRaster.GetRasterBand(1).WriteArray(np.zeros((rows, cols)))
polygonRaster.GetRasterBand(1).FlushCache() polygonRaster.GetRasterBand(1).FlushCache()
polygonRaster.SetGeoTransform(geotransform) polygonRaster.SetGeoTransform(geotransform)
polygonRaster.SetGeoTransform(geotransform)
polygonRaster.SetProjection(sr.ExportToWkt())
...@@ -70,6 +71,7 @@ def rasterWkt(wkt, inputfile, outputfile): ...@@ -70,6 +71,7 @@ def rasterWkt(wkt, inputfile, outputfile):
layer.CreateFeature(feature) layer.CreateFeature(feature)
gdal.RasterizeLayer(polygonRaster, [1], layer, burn_values=[255]) gdal.RasterizeLayer(polygonRaster, [1], layer, burn_values=[255])
polygonRaster.GetRasterBand(1).FlushCache()
#Draw output image #Draw output image
np_polygon = polygonRaster.GetRasterBand(1).ReadAsArray(0,0,cols,rows) np_polygon = polygonRaster.GetRasterBand(1).ReadAsArray(0,0,cols,rows)
......
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