Commit 20083f6a authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

wkt raster

parent e86c5ba7
......@@ -28,18 +28,18 @@ def createLayer(wkt, layerName="wkt"):
def getPolygonArray(image, wkt_geom):
rows, cols, geotransform = image.RasterYSize, image.RasterXSize, image.GetGeoTransform()
print(rows, cols, geotransform)
sr = osr.SpatialReference()
sr.ImportFromWkt(image.GetProjection())
sr = osr.SpatialReference(wkt=image.GetProjection())
# sr.ImportFromWkt(image.GetProjection())
# shapefile
driverShp = ogr.GetDriverByName("ESRI Shapefile")
data_source = driverShp.CreateDataSource("myShape.shp")
srs = osr.SpatialReference()
srs.ImportFromWkt(image.GetProjection())
layer = data_source.CreateLayer("wkt", srs, ogr.wkbPolygon)
geometry = ogr.CreateGeometryFromWkt(wkt_geom)
# srs = osr.SpatialReference()
# srs.ImportFromEPSG(4326)
layer = data_source.CreateLayer("wkt", sr, ogr.wkbPolygon)
geometry = ogr.CreateGeometryFromWkt(wkt)
feature = ogr.Feature(layer.GetLayerDefn())
# feature.SetStyleString("PEN(c:#FF0000,w:5px);")
......
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