This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2018-03-02 20:27:06 -05:00
bin/osmosis Update to latest binary releases (osmosis, mapsforge) 2018-02-25 23:06:14 -05:00
lists Adjust central america list 2018-03-02 20:27:06 -05:00
pymapsforge Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
.gitignore Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
azure_notes.md Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
download_maps.py Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
LICENSE-APACHE-2.0.txt Added licencing 2016-01-12 17:51:36 -05:00
LICENSE-CC-BY-SA-3.0.html Added licencing 2016-01-12 17:51:36 -05:00
poi-mapping.xml Updated to latest mapsforge poi mappings 2018-02-25 23:11:38 -05:00
process_maps.py Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
README.md Tweak readme, remove spurious script, add 3 more lists 2018-02-28 18:20:21 -05:00
sea.osm Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00
shape2osm.py Rework lists, update to match main mapsforge docs (land/sea polys in particular), overhaul README for better examples 2018-02-28 18:01:27 -05:00

Overview

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.

Dependencies / Prereqs

To run this program you'll need the following

  • A Linux environment
  • Python 3.x installed
  • Java 1.8 or higher installed (OpenJDK works)
  • wget installed
  • gdal-bin
  • python3-gdal (Ubuntu) installed

Installation

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.

Running

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.

Program Usage

usage: process_maps.py [-h] --map-list MAP_LIST [--use-ram]
                       [--max-heap-space MAX_HEAP_SPACE]
                       [--output-map-name OUTPUT_MAP_NAME] --maps-dir MAPS_DIR
                       [--no-map-download]

optional arguments:
  -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
                        values, default (1g) should be fine if not using
                        --use-ram argument
  --output-map-name OUTPUT_MAP_NAME
                        set the output .map and .poi file names
  --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

Examples

#./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
./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
./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

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

usage: download_maps.py [-h] --map-list MAP_LIST --map-dir MAP_DIR

optional arguments:
  -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

Example Usage

./download_maps.py --map-dir ./cache \
    --map-list lists/central_america.txt

./download_maps.py --map-dir ./cache \
    --map-list lists/midwest.txt

./download_maps.py --map-dir ./cache \
    --map-list lists/south_america.txt

Licencing

All code is licensed Apache 2.0 and all non-code is licensed Creative Commons CC-BY-SA-3.0