Since you’re dealing with vector data, you need to use
ogr instead of
gdal (it’s normally packaged along with
So you can do:
from osgeo import ogr ds = ogr.Open('export.txt') layer = ds.GetLayer(0) featureCount = layer.GetFeatureCount() print(featureCount)
There’s plenty of info out there on using
ogr, but this cookbook might be helpful.
CLICK HERE to find out more related problems solutions.