You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 lines
3.9 KiB

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 Mike "KemoNine" Crosson
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse, datetime, os
from pymapsforge import process, download
if __name__ == '__main__':
current_timestamp = datetime.datetime.now().strftime('%Y%m%d-%H%M')
parser = argparse.ArgumentParser()
parser.add_argument('--map-list', action='append', required=True,
help='a text file with one map URL per line, can be specified more than once')
parser.add_argument('--use-ram', action='store_true',
help='use RAM for mapsforge processing -- WARNING mapsforge uses 10x the map size in RAM for processing (ie. 100Mb map = 1Gb RAM usage), you want a LOT of RAM for this option')
parser.add_argument('--max-heap-space', action='store', default='1g',
help='set the max heap space for the JVM, use standard -Xmx values, default (1g) should be fine if not using --use-ram argument')
parser.add_argument('--output-map-name', action='store', default='output',
help='set the output .map and .poi file names')
parser.add_argument('--maps-dir', action='store', required=True,
help='Where downloaded maps will be stored/read from')
parser.add_argument('--no-map-download', action='store_true',
help='Do NOT download maps, re-use maps from maps-dir')
parser.add_argument('--tag-mapping', action='store',
help='Specify a custom tag mapping xml file for use with mapsforge processing')
parser.add_argument('--tag-transform', action='store',
help='Specify a tag transform file for use PRIOR to mapsforge processing (this is DIFFERENT than the mapsforge mapping xml file)')
parser.add_argument('--elevation-map', action='store',
help='Specify an elevation map (MUST BE THE WHOLE OUTPUT REGION OR LARGER) that is used for generating contour lines and elevation data in final map output. THIS IS NOT CROPPED, BE CAREFUL!!!')
args = parser.parse_args()
current_timestamp = datetime.datetime.now().strftime('%Y%m%d-%H%M')
base_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__))))
args.maps_dir = os.path.abspath(args.maps_dir)
process.setup_working_dirs(base_path, current_timestamp, args.output_map_name)
if not args.no_map_download:
download.download(args.maps_dir, args.map_list)
#if args.elevation_map is not None:
# process.prep_elevation_map(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name, args.max_heap_space, args.use_ram, args.elevation_map)
process.prep_land_sea_polys(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name)
process.process_land_sea_polys(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name, args.max_heap_space, args.use_ram, args.elevation_map)
if args.tag_transform is not None:
process.process_tag_transform(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name, args.max_heap_space, args.use_ram, args.tag_transform)
process.osmosis_main(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name, args.max_heap_space, args.use_ram, args.tag_mapping)
process.osmosis_pois(base_path, current_timestamp, args.maps_dir, args.map_list, args.output_map_name, args.max_heap_space)