Read Vector Data into Python
Using OGR's Python Bindings
#!/usr/bin/env python
import ogr
def read_vector(filepath):
datasource = ogr.Open(filepath)
layer = ds.GetLayerByIndex(0)
feature = layer.GetFeature(0)
return datasource
ds = read_vector('path/to/file.shp')
Using Fiona
$ pip install fiona
$ fio insp path/to/file.shp
>>> import pprint as pp
>>> pp.pprint(src[layer_id])
Using Geopandas
$ pip install geopandas
#!/usr/bin/env/ python
import geopandas as gp
df = gp.read_file('path/to/file.shp')
df.geometry[0]