def load_ogr_datasource(datasource, where=None):
    from imposm.util.ogr import OGRShapeReader

    polygons = []
    for wkt in OGRShapeReader(datasource).wkts(where):
        geom = shapely.wkt.loads(wkt)
        if geom.type == 'Polygon':
            polygons.append(geom)
        elif geom.type == 'MultiPolygon':
            for p in geom:
                polygons.append(p)
        else:
            log.info('skipping %s geometry from %s: not a Polygon/MultiPolygon',
                geom.type, datasource)

    return polygons
Loads polygons from any OGR datasource.
dataset/ETHPy150Open omniscale/imposm/imposm/util/geom.py/load_ogr_datasource