Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Loads polygons from any OGR datasource.

Returns a list of Shapely Polygons.

        def load_ogr_datasource(datasource, where=None):
    """
    Loads polygons from any OGR datasource.

    Returns a list of Shapely Polygons.
    """
    from mapproxy.util.ogr import OGRShapeReader

    polygons = []
    with closing(OGRShapeReader(datasource)) as reader:
        for wkt in reader.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_config.warn('skipping %s geometry from %s: not a Polygon/MultiPolygon',
                    geom.type, datasource)

    return polygons
        


src/m/a/MapProxy-1.6.0/mapproxy/config/coverage.py   MapProxy(Download)
from mapproxy.srs import SRS
from mapproxy.config import abspath
from mapproxy.util.geom import (
    load_datasource,
    load_ogr_datasource,
            datasource = abspath(datasource, base_path=base_path)
        where = conf.get('ogr_where', None)
        geom = load_ogr_datasource(datasource, where)
        bbox, geom = build_multipolygon(geom, simplify=True)
    elif 'polygons' in conf:

src/m/a/mapproxy-HEAD/mapproxy/config/coverage.py   mapproxy(Download)
from mapproxy.srs import SRS
from mapproxy.config import abspath
from mapproxy.util.geom import (
    load_datasource,
    load_ogr_datasource,
            datasource = abspath(datasource, base_path=base_path)
        where = conf.get('ogr_where', None)
        geom = load_ogr_datasource(datasource, where)
        bbox, geom = build_multipolygon(geom, simplify=True)
    elif 'polygons' in conf: