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

rgb l2

parent 0fbd735f
...@@ -49,7 +49,23 @@ def rasterWkt(wkt, inputfile, outputfile): ...@@ -49,7 +49,23 @@ def rasterWkt(wkt, inputfile, outputfile):
sr.ImportFromWkt(wkt) sr.ImportFromWkt(wkt)
output.SetProjection(sr.ExportToWkt()) output.SetProjection(sr.ExportToWkt())
gdal.RasterizeLayer(output, [1], createLayer(wkt), burn_values=[0])
# shapefile
driver = ogr.GetDriverByName("ESRI Shapefile")
data_source = driver.CreateDataSource("myShape.shp")
srs = osr.SpatialReference()
srs.ImportFromEPSG(4326)
layer = data_source.CreateLayer(layerName, srs, ogr.wkbPolygon)
geometry = ogr.CreateGeometryFromWkt(wkt)
feature = ogr.Feature(layer.GetLayerDefn())
feature.SetGeometry(geometry)
layer.CreateFeature(feature)
gdal.RasterizeLayer(output, [1], layer, burn_values=[0])
feature = None
data_source = None
output = None output = None
......
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