Beispiel #1
0
def get_by_code(code,
                path,
                area_type,
                catalog_path,
                with_attrs=False,
                epsilon=5,
                coord_out='EPSG:3857',
                output="output",
                display=False,
                with_log=True):
    area = Area(code,
                media_path=path,
                area_type=area_type,
                epsilon=epsilon,
                with_log=with_log,
                catalog=catalog_path,
                coord_out=coord_out)
    abspath = os.path.abspath(output)
    geojson = area.to_geojson_poly(with_attrs=with_attrs)
    if geojson:
        filename = '%s.geojson' % area.file_name
        geojson_path = os.path.join(abspath, "geojson")
        if not os.path.isdir(geojson_path):
            os.makedirs(geojson_path)
        file_path = os.path.join(geojson_path, filename)
        f = open(file_path, 'w')
        f.write(geojson)
        f.close()
        print(file_path)
        if display:
            area.show_plot()
    return area
Beispiel #2
0
def get_by_code(code, output, display, **kwargs):
    area = Area(code, **kwargs)
    abspath = os.path.abspath(output)
    geojson = area.to_geojson_poly()
    if geojson:
        filename = '%s.geojson' % area.file_name.replace(":", "_")
        geojson_path = os.path.join(abspath, "geojson")
        if not os.path.isdir(geojson_path):
            os.makedirs(geojson_path)
        file_path = os.path.join(geojson_path, filename)
        f = open(file_path, 'w')
        f.write(geojson)
        f.close()
        print("Vector - {}".format(file_path))
        if display:
            area.show_plot()
    return area
Beispiel #3
0
def get_by_code(code, path, area_type, catalog_path, with_attrs=False, epsilon=5,
                coord_out='EPSG:3857', output="output", display=False, center_only=False, with_log=True, with_proxy=False):
    area = Area(code, media_path=path, area_type=area_type, epsilon=epsilon, with_log=with_log, catalog=catalog_path,
                coord_out=coord_out, center_only=center_only, with_proxy=with_proxy)
    abspath = os.path.abspath(output)
    geojson = area.to_geojson_poly(with_attrs=with_attrs)
    if geojson:
        filename = '%s.geojson' % area.file_name.replace(":", "_")
        geojson_path = os.path.join(abspath, "geojson")
        if not os.path.isdir(geojson_path):
            os.makedirs(geojson_path)
        file_path = os.path.join(geojson_path, filename)
        f = open(file_path, 'w')
        f.write(geojson)
        f.close()
        print(file_path)
        if display:
            area.show_plot()
    return area
Beispiel #4
0
def get_by_code(code, path, area_type, catalog_path, with_attrs=False, epsilon=5,
                coord_out='EPSG:3857', output="output", display=False, center_only=False, with_log=True, 
                with_proxy=False, static_proxy="none", tile_mode="direct"):
    area = Area(code, media_path=path, area_type=area_type, epsilon=epsilon, with_log=with_log, catalog=catalog_path,
                coord_out=coord_out, center_only=center_only, with_proxy=with_proxy, static_proxy=static_proxy, tile_mode=tile_mode)
    abspath = os.path.abspath(output)
    geojson = area.to_geojson_poly(with_attrs=with_attrs)
    if geojson:
        filename = '%s.geojson' % area.file_name.replace(":", "_")
        geojson_path = os.path.join(abspath, "geojson")
        if not os.path.isdir(geojson_path):
            os.makedirs(geojson_path)
        file_path = os.path.join(geojson_path, filename)
        f = open(file_path, 'w')
        f.write(geojson)
        f.close()
        print(file_path)
        if display:
            area.show_plot()
    return area