Beispiel #1
0
def _main():

    # area = Area("38:36:000021:1106")
    # area = Area("38:06:144003:4723")
    # area = Area("38:36:000033:375")
    # area = Area("38:06:143519:6153", area_type=5)
    # 47:16:0650002:317  # multipolygon

    # code, output, path, epsilon, area_type = "38:06:144003:4723", "", "", 5, 1)

    opt = getopts()
    code = opt.code
    output = opt.output if opt.output else os.path.join("output")
    delay = getattr(opt, "delay", 1000)
    path = opt.path
    epsilon = opt.epsilon if opt.epsilon else 5
    area_type = opt.area_type if opt.area_type else 1
    with_attrs = opt.attrs if opt.attrs else False
    center_only = opt.center_only if opt.center_only else False
    refresh = opt.refresh
    display = opt.display
    coord_out = "EPSG:4326" if opt.wgs else "EPSG:3857"
    # csv = opt.csv
    catalog_path = "" if refresh else os.path.join(os.getcwd(), "catalog.json")
    if opt.list:
        file_name = os.path.splitext(os.path.basename(opt.list))[0]
        f = open(opt.list, 'r')
        codes = f.readlines()

        f.close()
        batch_parser(codes, media_path=path, area_type=area_type, catalog_path=catalog_path, coord_out=coord_out,
                     output=output, file_name=file_name, with_attrs=with_attrs, delay=delay, center_only=center_only, with_proxy=opt.proxy)

    elif code:
        get_by_code(code, path, area_type, catalog_path, with_attrs, epsilon, coord_out, output, display, center_only, with_proxy=opt.proxy)
Beispiel #2
0
def _main():
    # area = Area("38:36:000021:1106")
    # area = Area("38:06:144003:4723")
    # area = Area("38:36:000033:375")
    # area = Area("38:06:143519:6153", area_type=5)
    # 47:16:0650002:317  # multipolygon

    # code, output, path, epsilon, area_type = "38:06:144003:4723", "", "", 5, 1)
    opt = getopts()
    code = opt.code
    output = opt.output if opt.output else os.path.join("output")
    delay = getattr(opt, "delay", 1000)
    kwargs = {
        "media_path": opt.path,
        "with_proxy": opt.proxy,
        "epsilon": opt.epsilon if opt.epsilon else 5,
        "area_type": opt.area_type if opt.area_type else 1,
        "center_only": opt.center_only if opt.center_only else False,
        "use_cache": False if opt.refresh else True,
        "coord_out": "EPSG:4326",
    }

    if opt.list:
        file_name = os.path.splitext(os.path.basename(opt.list))[0]
        f = open(opt.list, 'r')
        codes = f.readlines()
        # cadastral number like this 02:00:000000 is not valid
        # def code_filter(c):
        #     s = re.search('^\d\d:\d+:[0]+', c)
        #     return not s
        # codes = filter(code_filter, codes)
        f.close()
        batch_parser(codes,
                     output=output,
                     delay=delay,
                     file_name=file_name,
                     **kwargs)

    elif code:
        get_by_code(code, output, display=opt.display, **kwargs)
Beispiel #3
0
def _main():

    # area = Area("38:36:000021:1106")
    # area = Area("38:06:144003:4723")
    # area = Area("38:36:000033:375")
    # area = Area("38:06:143519:6153", area_type=5)
    # 47:16:0650002:317  # multipolygon

    # code, output, path, epsilon, area_type = "38:06:144003:4723", "", "", 5, 1)

    opt = getopts()
    code = opt.code
    output = opt.output if opt.output else os.path.join("output")
    delay = getattr(opt, "delay", 1000)
    path = opt.path
    epsilon = opt.epsilon if opt.epsilon else 5
    area_type = opt.area_type if opt.area_type else 1
    with_attrs = opt.attrs if opt.attrs else False
    center_only = opt.center_only if opt.center_only else False
    refresh = opt.refresh
    display = opt.display
    coord_out = "EPSG:4326" if opt.wgs else "EPSG:3857"
    # csv = opt.csv
    catalog_path = "" if refresh else os.path.join(os.getcwd(), "catalog.json")
    if opt.list:
        file_name = os.path.splitext(os.path.basename(opt.list))[0]
        f = open(opt.list, 'r')
        codes = f.readlines()
        # cadastral number like this 02:00:000000 is not valid
        # def code_filter(c):
        #     s = re.search('^\d\d:\d+:[0]+', c)
        #     return not s
        # codes = filter(code_filter, codes)
        f.close()
        batch_parser(codes, media_path=path, area_type=area_type, catalog_path=catalog_path, coord_out=coord_out,
                     output=output, file_name=file_name, with_attrs=with_attrs, delay=delay, center_only=center_only, with_proxy=opt.proxy)

    elif code:
        get_by_code(code, path, area_type, catalog_path, with_attrs, epsilon, coord_out, output, display, center_only, with_proxy=opt.proxy)