Commit 9fb7a5ce authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

wkt raster

parent f6fdb829
...@@ -104,14 +104,15 @@ def rasterWkt(wkt, inputfile, outputfile): ...@@ -104,14 +104,15 @@ def rasterWkt(wkt, inputfile, outputfile):
#Burn Polygon #Burn Polygon
srs = osr.SpatialReference() srs = osr.SpatialReference()
srs.ImportFromEPSG(4326) srs.ImportFromEPSG(4326)
layer = data_source.CreateLayer("wkt", srs, ogr.wkbPolygon) layer = data_source.GetLayer()
geometry = ogr.CreateGeometryFromWkt(wkt) # layer = data_source.CreateLayer("wkt", srs, ogr.wkbPolygon)
# geometry = ogr.CreateGeometryFromWkt(wkt)
feature = ogr.Feature(layer.GetLayerDefn()) feature = ogr.Feature(layer.GetLayerDefn())
print("features") print("features")
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)
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