Using Fiona, you can open a shapefile and access attribute data, such as geometries. For example, our Natural Earth dataset contains a shapefile with all of the states in the US with their vector geometries. Use the following code to open the shapefile and get all of the vector geometry of the first feature (starting from index number 0):
In: import pprint, fiona with fiona.open\ (r"C:\data\gdal\NE\110m_cultural\ne_110m_admin_1_states_provinc es.shp") as src: pprint.pprint(src[0])
We can use the shape method and pass in all of the coordinates from Minnesota:
In: from shapely.geometry import shape minnesota = {'type': 'Polygon', 'coordinates': [[(-89.61369767938538, 47.81925202085796), ...