Esempio n. 1
0
    def __init__(self, database='srtm', offline=0, debug=False):
        '''Use offline=1 to disable any downloading of tiles, regardless of whether the
        tile exists'''
        self.database = database
        if self.database == 'srtm':
            self.downloader = srtm.SRTMDownloader(offline=offline, debug=debug)
            self.downloader.loadFileList()
            self.tileDict = dict()

        '''Use the Geoscience Australia database instead - watch for the correct database path'''
        if self.database == 'geoscience':
            from MAVProxy.modules.mavproxy_map import GAreader
            self.mappy = GAreader.ERMap()
            self.mappy.read_ermapper(os.path.join(os.environ['HOME'], './Documents/Elevation/Canberra/GSNSW_P756demg'))
parser.add_argument("--force", action='store_true', help="overwrite existing full blocks")
parser.add_argument("--radius", type=int, default=100, help="radius in km")
parser.add_argument("--debug", action='store_true', default=False)
parser.add_argument("--verbose", action='store_true', default=False)
parser.add_argument("--spacing", type=int, default=100, help="grid spacing in meters")
parser.add_argument("--pos-range", default=None, help="show position range for a file")
parser.add_argument("--test", action='store_true', help="test altitudes instead of writing them")
parser.add_argument("--test-threshold", default=2.0, type=float, help="test altitude threshold")
parser.add_argument("--directory", default="terrain", help="directory to use")
args = parser.parse_args()

if args.pos_range is not None:
    print(pos_range(args.pos_range))
    sys.exit(0)

downloader = srtm.SRTMDownloader(debug=args.debug)
downloader.loadFileList()

GRID_SPACING = args.spacing

done = set()

if args.test:
    err = test_directory()
    if err.errors:
        sys.exit(1)
    sys.exit(0)

if args.lat is None or args.lon is None:
    print("You must supply latitude and longitude")
    sys.exit(1)
Esempio n. 3
0
    # Number of threads to use
    parser.add_argument('-processes',
                        action="store",
                        dest="processes",
                        type=int,
                        default=4)
    # Latitude range
    parser.add_argument('-latitude',
                        action="store",
                        dest="latitude",
                        type=int,
                        default=60)

    args = parser.parse_args()

    downloader = srtm.SRTMDownloader(debug=False, cachedir='srtmcache')
    downloader.loadFileList()

    targetFolder = os.path.join(os.getcwd(), args.folder)
    #create folder if required
    try:
        os.mkdir(targetFolder)
    except FileExistsError:
        pass

    print("Storing in " + targetFolder)

    # store the threads
    processes = []

    # make tileID's
import os

from MAVProxy.modules.mavproxy_map import srtm
from argparse import ArgumentParser
from app import compressFiles

this_path = os.path.dirname(os.path.realpath(__file__))

parser = ArgumentParser(description='terrain data continent creator')

parser.add_argument("infolder", type=str, default="./files")
parser.add_argument("outfolder", type=str, default="./continents")

args = parser.parse_args()

downloader = srtm.SRTMDownloader(debug=False)
downloader.loadFileList()

continents = {}

# Create mappings of long/lat to continent
for (lonlat, contfile) in downloader.filelist.items():
    continent = str(contfile[0][:-1])
    filename = os.path.join(this_path, args.infolder,
                            str(contfile[1]).split(".")[0] + ".DAT.gz")
    print(continent + " in " + filename)

    # add to database
    if continent != '' and continent != 'USGS':
        if continent in continents:
            continents[continent].append(filename)