2
python gdal / ogrを使用して座標のリストからポリゴンシェープファイルを作成する方法
オープンソースのPythonツールを使用して、座標のリストからポリゴンシェープファイルを作成しようとしています。以下は、Python GDAL / OGRクックブックとこのGIS SEの回答から一緒にハッキングされた、これまでのところです。 同様の質問Pythonがあります:X、Y座標のリストからポリゴンシェープファイルを作成する方法?ただし、この質問はの使用に言及していpyshpます。ただし、gdal / ogr Pythonツールのみを使用してポリゴンシェープファイルを作成することに興味があります。 import ogr def create_polygon(coords): ring = ogr.Geometry(ogr.wkbLinearRing) for coord in coords: ring.AddPoint(coord[0], coord[1]) # Create polygon poly = ogr.Geometry(ogr.wkbPolygon) poly.AddGeometry(ring) return poly.ExportToWkt() def write_shapefile(poly, out_shp): """ /gis//a/52708/8104 """ # Now convert it to a shapefile with OGR driver = ogr.GetDriverByName('Esri Shapefile') …