>>> from osgeo import ogr
>>> from shapely.wkb import loads
>>> source = ogr.Open("testpoly.shp")
>>> couche = source.GetLayerByName("testpoly")
>>> for element in couche:
... geom = loads(element.GetGeometryRef().ExportToWkb())
... if geom.geom_type == 'Point':
... print geom.type
... print geom
... if geom.geom_type == 'LineString':
... print geom.type
... print geom
... if geom.geom_type == 'MultiLineString':
... print geom.type
... print geom
... if geom.geom_type == 'MultiPolygon':
... print geom.type
... print geom
... if geom.geom_type == 'Polygon':
... print geom.type
... print geom
...
Polygon
POLYGON ((0.0909447004608295 0.8075576036866359, 0.1416359447004608 0.8014746543778801, 0.3606221198156682 0.7021198156682027, 0.2409907834101383 0.5480184331797234, 0.0868894009216590 0.5845161290322580, 0.0544470046082949 0.7426728110599077, 0.0909447004608295 0.8075576036866359))
Polygon
POLYGON ((0.2754608294930876 0.7933640552995391, 0.5370276497695853 0.8136405529953916, 0.4173963133640554 0.5926267281105990, 0.2267972350230415 0.6777880184331797, 0.2267972350230415 0.7447004608294931, 0.2754608294930876 0.7933640552995391))