예제 #1
0
def get_args(sys_argv):
    args = MapArgs(sys_argv)
    if (args.location is None) and (args.gpx is None) and ((args.lat is None) or (args.lng is None)):
        args.print_help()
        os.kill(os.getpid(), signal.SIGTERM)
        sys.exit(0)

    if ((args.lat is None) or (args.lng is None)) and (args.gpx is None):
        locations = ctx_map.get_locations()
        if (not args.location in locations.keys()):
            args.location = ctx_map.search_location(args.location)
            if (args.location[:6] == "error="):
                print args.location[6:]
                sys.exit(0)

        coord = ctx_map.get_locations()[args.location]
        args.lat = coord[0]
        args.lng = coord[1]

    if args.gpx:
        # GPX path mode
        args.width = int(args.width)
        if args.width < 0:
            args.width = 2  # The default for GPX
    else:
        if args.width > 0:
            args.lng_range = km_to_lon(args.width, args.lat)
        if args.height > 0:
            args.lat_range = km_to_lat(args.height)
    return args
예제 #2
0
파일: download.py 프로젝트: pacoqueen/cican
    for zl in range(max_zl, min_zl - 1, -1):
        sys.stdout.write("\nDownloading zl %d \t" % zl)
        downloader.query_region_around_location(
            lat, lng,
            lat_range*2, lng_range*2, zl,
            layer, dl_callback,
            conf=mConf
        )
        downloader.wait_all()

if __name__ == "__main__":

    args = MapArgs(sys.argv)

    if (args.location is None) and ((args.lat is None) or (args.lng is None)):
        args.print_help()
        sys.exit(0)

    print "location = %s" % args.location
    if ((args.lat is None) or (args.lng is None)):
        locations = ctx_map.get_locations()
        if (not args.location in locations.keys()):
            args.location = ctx_map.search_location(args.location)
            if (args.location[:6] == "error="):
                print args.location[6:]
                sys.exit(0)

        coord = ctx_map.get_locations()[args.location]
        args.lat = coord[0]
        args.lng = coord[1]
예제 #3
0
                                                lng,
                                                lat_range * 2,
                                                lng_range * 2,
                                                zl,
                                                layer,
                                                dl_callback,
                                                conf=mConf)
        downloader.wait_all()


if __name__ == "__main__":

    args = MapArgs(sys.argv)

    if (args.location is None) and ((args.lat is None) or (args.lng is None)):
        args.print_help()
        sys.exit(0)

    print "location = %s" % args.location
    if ((args.lat is None) or (args.lng is None)):
        locations = ctx_map.get_locations()
        if (not args.location in locations.keys()):
            args.location = ctx_map.search_location(args.location)
            if (args.location[:6] == "error="):
                print args.location[6:]
                sys.exit(0)

        coord = ctx_map.get_locations()[args.location]
        args.lat = coord[0]
        args.lng = coord[1]