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

wkt raster

parent 809a6571
...@@ -31,22 +31,22 @@ def getPolygonArray(image, wkt_geom): ...@@ -31,22 +31,22 @@ def getPolygonArray(image, wkt_geom):
sr = osr.SpatialReference() sr = osr.SpatialReference()
sr.ImportFromWkt(image.GetProjection()) sr.ImportFromWkt(image.GetProjection())
# # shapefile # shapefile
# driverShp = ogr.GetDriverByName("ESRI Shapefile") driverShp = ogr.GetDriverByName("ESRI Shapefile")
# data_source = driverShp.CreateDataSource("myShape.shp") data_source = driverShp.CreateDataSource("myShape.shp")
# srs = osr.SpatialReference() srs = osr.SpatialReference()
# srs.ImportFromEPSG(4326) srs.ImportFromEPSG(4326)
# layer = data_source.CreateLayer("wkt", srs, ogr.wkbPolygon) layer = data_source.CreateLayer("wkt", srs, ogr.wkbPolygon)
# geometry = ogr.CreateGeometryFromWkt(wkt) geometry = ogr.CreateGeometryFromWkt(wkt)
# feature = ogr.Feature(layer.GetLayerDefn()) feature = ogr.Feature(layer.GetLayerDefn())
## 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)
#
# data_source = None data_source = None
rast_ogr_ds = ogr.GetDriverByName('Memory').CreateDataSource( 'wrk' ) rast_ogr_ds = ogr.GetDriverByName('Memory').CreateDataSource( 'wrk' )
rast_mem_lyr = rast_ogr_ds.CreateLayer( 'poly', srs=sr ) rast_mem_lyr = rast_ogr_ds.CreateLayer( 'poly', srs=sr )
......
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