User Tools

Site Tools


Convert from OpenStreetMap to Mapsforge using Osmosis

This document provides an overview of the procedure to convert data sourced from OpenStreetMap to the binary format used by Mapsforge, a library used to render maps on Android devices.

Processing power, memory and storage are limited on many Android devices, so it is recommended that the smallest geographic area be converted for use on the mobile device.

This procedure converts entire data files sourced from OpenStreetMap. It does not describe how to convert only a region of one of these larger data files.

Step 0. Assumptions

  1. The latest version of Osmosis, an application for manipulating !OpenStreetMap data is installed correctly on your system
  2. The latest version of the Mapsforge Mapfile-Writer plugin for Osmosis is installed correctly on your system
  3. You are familiar with the command line interface of your preferred operating system

Note: This procedure was developed for Ubuntu 11.04, but the principles are the same for all platforms.

Step 1. Download the OpenStreetMap Data

  1. Create a new folder on your system to store the data
  2. Open a new Internet browser window
  3. Select the folder that represents the geographic area of interest
  4. Repeat step 1.4 narrowing the selection to the smallest geographic area until all folders have been explored
  5. Examine the name of the files to determine which file represents the required geographic area
  6. Download the file with the name of the geographic area that ends with the .pbf extension and is described as OpenStreetMap data, protobuf binary format
  7. Save the file in the folder created in point 1

Example - Download data for Washington, USA

  1. Click on the north-america link
  2. Click on the uslink
  3. Scroll down the page
  4. Download the file labeled washington.osm.pbf
  5. Save the file in the folder created in point 1

Example - Download data for New Zealand

  1. Click on the australia-oceania link
  2. Download the file labeled new-zealand.osm.pbf
  3. Save the file in the folder created in point 1

Step 2. Convert the OpenStreetMap Data

  1. Open a new terminal window
  2. Change to the folder where Osmosis is installed
  3. Change to the bin sub-directory
  4. Execute the following command
    ./osmosis --rb {osm-path} --mw {mapsforge-path}


    • {osm-path} is the path of the OpenStreetMap file downloaded in step 1
    • {mapsforge-path} is the path of the Mapsforge file that will be created
    • Note: ensure that paths and file names do not include spaces
  5. Wait for the conversion to complete (this will take some time)
content/servalmaps/osmosis.txt · Last modified: 24/05/2013 09:21 by Andrew Bettison