def main(): parser = argparse.ArgumentParser(usage="Valhalla Tilepack Download tool. If no Tilepack ID is provided, the latest Tilepack is used.") parser.add_argument('--id', help='Tilepack ID', default='latest') parser.add_argument('--outpath', help='Output path for Valhalla Tilepack; default is tiles.tar', default='tiles.tar') parser.add_argument('--api-token', help='Interline Auth Token; default is read from $INTERLINE_API_TOKEN') parser.add_argument('--compressed', help='Do not decompress Tilepack', action='store_true') parser.add_argument('--verbose', help="Verbose output", action='store_true') args = parser.parse_args() if args.verbose: log.set_verbose() outpath = args.outpath if args.compressed: if not (outpath.endswith('.tar') or outpath.endswith('.tgz')): log.warning("Warning: compressed output path %s does not in end in .tar.gz or .tgz"%outpath) else: if not outpath.endswith('.tar'): log.warning("Warning: decompressed output path %s does not end in .tar"%outpath) downloader = TilepackDownloader() downloader.download( outpath, version=args.id, compressed=args.compressed, api_token=args.api_token or os.getenv('INTERLINE_API_TOKEN') )
def main(): parser = argparse.ArgumentParser() parser.add_argument('--outpath', help='Output path for elevation tiles.', default='.') parser.add_argument('--csv', help='Path to CSV file with bounding box definitions.') parser.add_argument( '--bbox', help= 'Bounding box for extract file. Format for coordinates: left,bottom,right,top' ) parser.add_argument('--verbose', help="Verbose output", action='store_true') args = parser.parse_args() if args.verbose: log.set_verbose() p = ElevationTileDownloader(args.outpath) if args.csv: p.download_bboxes(load_bboxes_csv(args.csv)) elif args.bbox: p.download_bbox(bbox_string(args.bbox)) else: p.download_planet()
def _test_self(): ''' Manual test for this module. Run multiple instances of this script to see locking in action. ''' import os import tempfile from log import info, set_verbose set_verbose(True) def timeout_cb(): info('Oops, we got a timeout!') def still_waiting_cb(): info('Still waiting!') with FileLock(os.path.join(tempfile.gettempdir(), 'lock-test'), timeout=20, timeout_cb=timeout_cb, still_waiting_cb=still_waiting_cb): info('Starting "with" block') time.sleep(15) info('Finishing "with" block')
def main(): parser = argparse.ArgumentParser(usage="OSM Extract Download tool.") parser.add_argument('id', help='Extract ID') # parser.add_argument('--osm-extract-version', help='OSM Extract version', default='latest') parser.add_argument('--outpath', help='Output path for Extract; default is <name>.osm.pbf') parser.add_argument('--api-token', help='Interline Auth Token; default is read from $INTERLINE_API_TOKEN') parser.add_argument('--verbose', help="Verbose output", action='store_true') args = parser.parse_args() if args.verbose: log.set_verbose() outpath = args.outpath or "%s.osm.pbf"%(args.id) if os.path.exists(outpath): log.warning("Warning: output path %s already exists."%outpath) downloader = OsmExtractDownloader() downloader.download( outpath, osm_extract_id=args.id, api_token=args.api_token or os.getenv('INTERLINE_API_TOKEN') )
def main(): parser = argparse.ArgumentParser() parser.add_argument( 'osmpath', help= 'Name or path to existing OSM planet file. Will be created and downloaded, if it does not exist.' ) parser.add_argument( 'outpath', help='Name or path to where updated output file should be placed.') parser.add_argument( '--s3', action='store_true', help= 'Download using S3 client from AWS Public Datasets program. AWS credentials required.' ) parser.add_argument('--workdir', help="Osmosis replication workingDirectory.", default='.') parser.add_argument('--verbose', help="Verbose output", action='store_true') args = parser.parse_args() if args.verbose: log.set_verbose() if not os.path.exists(args.osmpath): log.info("planet does not exist; downloading") if args.s3: d = PlanetDownloaderS3(args.osmpath) else: d = PlanetDownloaderHttp(args.osmpath) d.download_planet() p = PlanetUpdaterOsmosis(args.osmpath) p.update_planet(args.outpath)