Read Shapefile with GDAL

Python -- Posted on Sept. 2, 2018

Read Shapefile with gdal

              
                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()
                  
   
            

Related Posts