Dimitris Kougioumtzis Blog About technology

Read Shapefile with GDAL

Category Python

Posted on Sept. 2, 2018



Read Shapefile with gdal


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from osgeo import ogr
shapefile = ogr.Open("shapefile.shp")
layer = shapefile.GetLayer(0)
crs = layer.GetSpatialRef()
print(crs)
print(crs.GetAttrValue('AUTHORITY',1))
for i in range(layer.GetFeatureCount()):
    feature = layer.GetFeature(i)
    print(feature.GetGeometryRef())
    geometry = feature.GetGeometryRef()

About

My name is Dimitris Kougioumtzis and i work as a Web developer at Rapidbounce Company

Elsewhere