2018-02-25 21:50:00 +00:00
# Overview
2017-01-20 17:38:42 +00:00
This project contains useful info/tools for processing OSM maps into the mapwriter file format (.map). It was developed to help generating offline map files for Locus on Android.
2016-01-12 19:12:34 +00:00
2018-02-25 21:50:00 +00:00
# Dependencies / Prereqs
2017-01-20 17:38:42 +00:00
To run this program you'll need the following
2016-01-12 19:12:34 +00:00
2017-01-20 17:38:42 +00:00
* A Linux environment
* Python 3.x installed
* Java 1.8 or higher installed (OpenJDK works)
* wget installed
2018-02-28 23:01:27 +00:00
* gdal-bin
* python3-gdal (Ubuntu) installed
2017-01-20 17:38:42 +00:00
2018-02-25 21:50:00 +00:00
# Installation
2017-01-20 17:40:34 +00:00
Head over to releases tab and download the latest. Extract the file and you're good to go. Everything is self-contained minus the above dependencies.
2017-01-20 17:38:42 +00:00
2018-02-25 21:50:00 +00:00
# Running
2017-01-20 17:38:42 +00:00
To run the program, cd to the directory where you extracted the release and run './process_maps.py' with at least one '--map-list /path/to/list.txt parameter'. See the lists directory for examples on how to format the map list files.
2018-02-25 21:50:00 +00:00
### Program Usage
2017-01-20 17:39:55 +00:00
```
2018-02-28 23:01:27 +00:00
usage: process_maps.py [-h] --map-list MAP_LIST [--use-ram]
2018-02-25 21:17:57 +00:00
[--max-heap-space MAX_HEAP_SPACE]
2018-02-28 23:01:27 +00:00
[--output-map-name OUTPUT_MAP_NAME] --maps-dir MAPS_DIR
[--no-map-download]
2017-01-20 17:38:42 +00:00
optional arguments:
2018-02-25 21:17:57 +00:00
-h, --help show this help message and exit
--map-list MAP_LIST a text file with one map URL per line, can be
specified more than once
--use-ram 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
--max-heap-space MAX_HEAP_SPACE
set the max heap space for the JVM, use standard -Xmx
2018-02-28 23:01:27 +00:00
values, default (1g) should be fine if not using
2018-02-25 21:17:57 +00:00
--use-ram argument
--output-map-name OUTPUT_MAP_NAME
set the output .map and .poi file names
2018-02-28 23:01:27 +00:00
--maps-dir MAPS_DIR Where downloaded maps will be stored/read from
--no-map-download Do NOT download maps, re-use maps from maps-dir
2017-01-20 17:39:55 +00:00
```
2016-01-12 22:51:36 +00:00
2018-02-25 21:50:00 +00:00
### Examples
```
2018-02-28 23:01:27 +00:00
#./process_maps.py --use-ram --max-heap-space 16g --maps-dir cache --no-map-download --output-map-name pennsylvania --map-list lists/pennsylvania.txt
#./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name idaho --map-list lists/idaho.txt
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name netherlands --map-list lists/netherlands.txt
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name spain --map-list lists/spain.txt
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name france --map-list lists/france.txt
2018-02-28 23:20:21 +00:00
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name belgium --map-list lists/belgium.txt
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name luxembourg --map-list lists/luxembourg.txt
./process_maps.py --use-ram --max-heap-space 12g --maps-dir cache --no-map-download --output-map-name portugal --map-list lists/portugal.txt
2018-02-28 23:01:27 +00:00
./process_maps.py --use-ram --max-heap-space 24g --maps-dir cache --no-map-download --output-map-name australia_oceania --map-list lists/australia_oceania.txt
./process_maps.py --use-ram --max-heap-space 24g --maps-dir cache --no-map-download --output-map-name australia --map-list lists/australia.txt
./process_maps.py --use-ram --max-heap-space 16g --maps-dir cache --no-map-download --output-map-name canada_ontario --map-list lists/ontario.txt
./process_maps.py --use-ram --max-heap-space 24g --maps-dir cache --no-map-download --output-map-name local --map-list lists/midwest.txt --map-list lists/ontario.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa_midwest --map-list lists/usa_midwest.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa_northeast --map-list lists/usa_northeast.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa_pacific --map-list lists/usa_pacific.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa_south --map-list lists/usa_south.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa_west --map-list lists/usa_west.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name central_america --map-list lists/mexico.txt --map-list lists/central_america.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name south_america --map-list lists/south_america.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name usa --map-list lists/usa.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name canada --map-list lists/canada.txt
./process_maps.py --max-heap-space 8g --maps-dir cache --no-map-download --output-map-name north_america --map-list lists/north_america.txt
2018-02-25 21:50:00 +00:00
```
# Caching maps for re-use / re-processing
Included in the repo there is a ```download_maps.py``` script that is meant to help with downloading maps on a schedule or for caching. It uses the same logic as the main script but for download only.
### Program usage
```
2018-02-28 23:01:27 +00:00
usage: download_maps.py [-h] --map-list MAP_LIST --map-dir MAP_DIR
2018-02-25 21:50:00 +00:00
optional arguments:
2018-02-28 23:01:27 +00:00
-h, --help show this help message and exit
--map-list MAP_LIST a text file with one map URL per line, can be specified
more than once
--map-dir MAP_DIR The directory where maps should be downloaded
2018-02-25 21:50:00 +00:00
```
### Example Usage
```
2018-02-28 23:01:27 +00:00
./download_maps.py --map-dir ./cache \
--map-list lists/central_america.txt
2018-02-25 21:50:00 +00:00
2018-02-28 23:01:27 +00:00
./download_maps.py --map-dir ./cache \
--map-list lists/midwest.txt
2018-02-25 21:50:00 +00:00
2018-02-28 23:01:27 +00:00
./download_maps.py --map-dir ./cache \
--map-list lists/south_america.txt
2018-02-25 21:50:00 +00:00
```
# Licencing
2016-01-12 22:51:36 +00:00
All code is licensed Apache 2.0 and all non-code is licensed Creative Commons CC-BY-SA-3.0