OsmAndMapCreator

From OpenStreetMap Wiki
Jump to navigation Jump to search
OsmAndMapCreator
OsmAndMapCreator DE.png
License: GNU GPL v3
Platforms: Windows, Linux, and macOS
Version: (2019-10-16)
Language: English
Website: https://osmand.net/docs/technical/map-creation/create-offline-maps-yourself/#osmandmapcreator
Source code: https://github.com/osmandapp/OsmAnd-tools/tree/master/java-tools/OsmAndMapCreator
Programming language: Java

OsmAnd data file parser and creator

Features
Feature Value
Map Display
Display map yes
Map data raster;vector
Source cache;offline;tiles
Rotate map
3D view
Shows website
Shows phone number
Shows operation hours
Routing

(Not set)

Navigating

(Not set)

Tracking

(Not set)

Monitoring

(Not set)

Editing
Add POIs
Edit / Delete POIs no
Add way
Edit geometries no
Edit arbitrary tags of existing OSM objects no
Edit relations no
View notes
Create notes
Edit notes
Work offline no
Support imagery offset DB
Upload to OSM no
Rendering

(Not set)

Accessibility
Accessibility support
Complete non graphics text output no
Braille interface no
Exploration modus
Public Transport mode
Danger Warnings
Screenreader
Screenreader languages


OsmAndMapCreator is a program that accompanies OsmAnd for making offline-usable data files. The most important feature is the creation of OBF files out of OSM data. Other functions allow the user to create POI, address, transit, and routing indexes from OSM files (.osm, .bz2, .pbf). OBF format is the output format and used by OsmAnd for offline rendering, routing, and search on a mobile device.


Process of Map Creation

  1. Download an OSM data extract (PBF format from Geofabrik for the area you want to convert to OBF. Please pay attention to the high RAM consumption of OsmAndMapCreator (see below).
  2. If the extract is too large, you have to clip a smaller area out of it using Osmconvert.
  3. Create the OBF file with OsmAndMapCreator.
  4. Copy the resulting OBF file to your smartphone.

Downloading OsmAndMapCreator

OsmAndMapCreator does not need to be installed at your computer, just Java (Windows - Java Se 19.0.02 Tested working) or OpenJDK (Linux, OSX) has to be installed. You do not need administrative/root access if Java is installed already. If you do not know if Java is installed, just open a command line window and run the command java. If the output describes some arguments for starting Java and does not show a simple "file not found" (or something like this), Java is installed. More recent versions of OsmAndMapCreator need at least Java 17 to run, otherwise you will get error messages like Unsupported major.minor version 61.0. You can find out the current Java Version by calling java -version.

OsmAndMapCreator can be downloaded from developers' website. Afterwards extract the download zip-archive at any directory. If you use a Unix-like operating system (OS X, Linux) you have to make the .sh file excutable.

Creating Single OBF Files using the Graphical User Interface

Starting OsmAndMapCreator by a simple double-click is not the right way. You should assign OsmAndMapCreator more RAM than usually Java does in order that OsmAndMapCreator does not abort of lack of memory.

  • Users with command line experience: Open a command line window, change directory (cd) to the directory where OsmAndMapCreator.jar is and run the command java -jar -Xms1G -Xmx6G OsmAndMapCreator.jar. The numbers following -Xms and -Xmx declare the amount of RAM you assign to OsmAndMapCreator/Java. M stands for megabyte, G for gigabyte. The amount depends on the amount of RAM your computer has and the size of the PBF file. Details see below.
  • Users without command line experience: Open a file manager window (Windows Explorer, Nautilus etc.), change to the directory where OsmAndMapCreator.jar is and double-click OsmAndMapCreator.bat (Windows) / OsmAndMapCreator.sh (OS X/Linux). The bat or sh file starts OsmAndMapCreator and asserts a defined amount of memory as the command above. You should adapt the amount of memory in the bat/sh file. Details see below.

After starting OsmAndMapCreator, click on File, then on Create .obf from OSM file and select the downloaded/clipped PBF file. Wait until OsmAndMapCreator has finished. If you want to create a second OBF file, you should restart OsmAndMapCreator because OsmAndMapCreator does not free the used RAM.

Regular Creation of OBF Files (via Command Line)

If you use OBF files periodically you would like to automate this process. Even if it does not seem so, OBF files can be created via command line (and therefore via cronjobs)

This section appears to be out of date. According to the OsmAnd documentation,

RAM requirement

RAM usage

OsmAndMapCreator needs a multiple of the size of the OBF file. You should only make OBF files of large areas if your computer has enough RAM. Please remember that the operating system also needs some RAM. Just have a look at task manager in idle state. Remember that 32-Bit systems can only use 3.3 GB RAM.

The following table lists the example file size and memory consumption. Please bear in mind that OSM contains more and more data. That's why PBF files increase day by day.

Annotation: This table is not finish. You can add your values if you created an OBF file. Please only add your RAM and time consumption if you have not run any other programs with high RAM consumption at the same time. (similar test conditions)

region size of PBF file RAM consumption RAM assigned at starting OsmAndMapCreator time consumption output size of obf file
Baden-Württemberg, Germany 220 MB ca, 3 h 15 min (Linux 64 Bit, Intel Core i5-460M, 8 GB RAM)
Bayern, Germany 586 MB 15 GB 1 GB–17 GB (-Xms4G -Xmx16G) 2:35 h:min; (Linux Debian 9, Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz, 20 GB RAM) 1,1 GB
Bavaria, Germany 300 MB aborted by user after more than 7 h (Linux 64 Bit, Intel Core i5-460M, 8 GB RAM)
Bielefeld 19 MB 281 MB 5,5 min (Linux 32, Intel(R) Pentium(R) 4 CPU 2.66GHz, 2 GB RAM)
Sachsen-Anhalt, Germany 46 MB ca. 15–20 min (Linux 64 Bit, Intel Core i5-460M, 8 GB RAM)z
Germany 2.5 GB less than 6 GB 14GB + Harddrive ~54 hours (Linux 64 Bit, Intel Core i7-4700MQ @ 2.40GHz, 16 GB RAM, mostly idle the complete time of conversion)
Berlin 43 MB 14 GB ~4 minutes (Linux 64 Bit, Intel Core i7-4700MQ @ 2.40GHz, 16 GB RAM, mostly idle the complete time of conversion) 98 MB
Lower Saxony, Germany 214 MB less than 6 GB 14G B ~40 minutes (Linux 64 Bit, Intel Core i7-4700MQ @ 2.40GHz, 16 GB RAM, mostly idle the complete time of conversion) 414 MB
Munich, Germany 27 MB ~4 GB 2 GB (+ 2 GB swap) ~60 minutes (Linux 64 Bit, Intel Core 2 Duo CPU T8300 @ 2.40GHz, 2GB RAM + 2GB swap, at the begin nothing else worked due to high ram- and hdd-use) 58 MB
Rhineland-Platinate, Germany 157 MB 4,1 GB 1–12 GB 15 min (Win 7 64bit, AMD FX-8350 4 GHz, 16 GB RAM)
Brandenburg, Germany 129 MB 2,5 GB 1–4 GB ca. 1 h, (openSUSE 13.1 64, AMD Athlon(tm) 64 X2 Dual Core Processor 4600+, 7 GB RAM
Baden-Württemberg, Germany 386 MB 15,2 GB (including swap) 64 MB–11,8 GB 4:41 (Linux, Intel Core i5-6400, SSD Crucial BX100 500GB (CT500BX100SSD1), 16 GB RAM), sqlite_in_memory 562 MB
Hessen, Germany 203 MB ~ 5 GB 1 GB – 6 GB 2:30 (Debian 64bit, Intel Core2 Duo P8400, 8 GB RAM) 375 MB
Georgia, United States 174 MB ~5 GB (plus some swap) 512 MB–6 GB (-Xms512M -Xmx6144M) 2.5 h (Windows, Intel Core i7-3612QM @ 2.1GHz, 8 GB RAM) 265 MB
Ontario, Canada 581 MB 11.2 GB 1 GB–13 GB (-Xms1G -Xmx13G) 7 h (Windows, Intel Core i7-3770 @ 3.4GHz, 16 GB RAM) 695 MB
Québec, Canada 352 MB 9 GB 1 GB–13 GB (-Xms1G -Xmx13G) 3 h (Windows, Intel Core i7-3770 @ 3.4GHz, 16 GB RAM) 490 MB
Ukraine, whole country 378 MB 64 MB–6.8 GB (-Xms64M -Xmx6800M) 2:42 h (MacOS, Intel Core i5 @ 2.8GHz, 8 GB RAM) 738 MB
Unterfranken, Deutschland 61,53 MB 6,4 GB 4 GB–16GB  (-Xms4G - Xmx16G) 00:08:50 hh:mm:ss (Linux Debian 9, Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz, 20 GB RAM) 112 MB
Utah, USA 65 MB 5.2 GB 4 GB-14 GB (-Xms4G -Xmx14G) 7.5 min (Linux, AMD Ryzen 7 2700 @ 2.2 GHz, 16 GB RAM) 125 MB

Areas at the size of 300 MB PBF file size and more cannot be converted into OBF format at a stretch without using sqlite_in_memory. You have to split this areas and convert each parts. That's why the OsmAnd developers do not provide whole Germany as OBF for download.

Adapt amount of assigned RAM

Set the JAVA_OPTS environmental variable to (or add to a preexisting JAVA_OPTS variable) the following string -Xms256M -Xmx6400M. Replace this values (256M and 6400M) by values from the table above.

You should leave at least 1.3 GB for the operating system if you use Windows.

Under GNU/Linux this amount depends on your desktop environment, e.g. 800 MB for the RAM-hungry Unity.

Example calculation:

(1) installed RAM 4 GB
(2) RAM consumption in idle state (depends on operating system, see task manager) 1.3 GB
(3) difference between (1) and (2) 2.7 GB
(4) minimal RAM assignation (value after -Xms) 200 MB
(5) maximum RAM assignation (value after -Xmx) 2.5 GB (Do not use a decimal separator, write -Xmx2500M instead.)

There must not be a space between -Xms or -Xmx and the numerical value.

Copy OBF File(s) to mobile phone

The finished OBF file(s) are stored directly in the "Data storage folder" on the mobile device as specified in the OsmAnd settings, alongside any OBF files you downloaded from the official OsmAnd server. On modern Android versions, this may be something like /data/user/0/net.osmand/no_backup or /storage/emulated/0/Android/data/net.osmand/files. Your files should then appear on the "Local" tab of the "Download maps" page, but you may need to take some extra steps before your data is fully reflected on the map:

  1. Be sure to deactivate any official map of the same region, otherwise you may see a mishmash of your data and the official data. If you are using OsmAnd Live, you may also need to delete any OsmAnd Live data for the region (see this issue report).
  2. You may need to deactivate and reactivate your files before they take effect. Alternatively, you can copy your files directly to OsmAnd's "inactive maps" directory (the backup subdirectory of the "Data storage folder") and then activate them.
  3. If you already had a route open, installing new maps does not by itself trigger recalculation of the route to reflect the new maps. You'll need to make some dummy change to the routing query, such as changing the profile from car to bicycle and back.

See also