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

wkt raster

parent 9c40a3a1
...@@ -45,8 +45,6 @@ def getPolygonArray(image, wkt): ...@@ -45,8 +45,6 @@ def getPolygonArray(image, wkt):
# feature.SetStyleString("PEN(c:#FF0000,w:5px);") # feature.SetStyleString("PEN(c:#FF0000,w:5px);")
feature.SetGeometry(geometry) feature.SetGeometry(geometry)
layer.CreateFeature(feature) layer.CreateFeature(feature)
#Set up polygon raster #Set up polygon raster
...@@ -55,8 +53,10 @@ def getPolygonArray(image, wkt): ...@@ -55,8 +53,10 @@ def getPolygonArray(image, wkt):
polygonRaster.GetRasterBand(1).SetNoDataValue(-99) polygonRaster.GetRasterBand(1).SetNoDataValue(-99)
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.SetProjection(sr.ExportToWkt()) # polygonRaster.SetProjection(sr.ExportToWkt())
polygonRaster.SetProjection(image.GetProjectionRef())
polygonRaster.SetGeoTransform(image.GetGeoTransform())
#Burn Polygon #Burn Polygon
gdal.RasterizeLayer(polygonRaster, [1], layer, burn_values=[255]) gdal.RasterizeLayer(polygonRaster, [1], layer, burn_values=[255])
polygonRaster.GetRasterBand(1).FlushCache() 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