splash

Osm2GpsMid

SourceForge.net Logo


Please note - much of the information on GpsMid web pages, especially on development, is outdated - please see the GpsMid wiki for current information.

This page describes how to bundle and customize GpsMid to contain the maps of the area you are interested in. To find out more about GpsMid itself and its features, please go back to the main page. To create map data for GpsMid, you can use Osm2GpsMid. This application will read in OpenStreetMap data (.osm file), such as a country extract or the whole planet.osm, filter the interesting area, convert the data and write the J2ME application and the JAD-file.

You might be able to use of the pre generated maps we offer. If these cover the region you are interested in and you don't want to customize GpsMid you won't need Osm2GpsMid

Requirements

Obtaining a .osm file

A .osm file is an XML based file containing data from OpenStreetMap. There are several ways to obtain .osm files for an area of interest, which can then be converted and bundled into GpsMid Since version 0.7 Osm2GpsMid also supports OpenStreetMap's new binary format .osm.pbf This format is about 30% smaller to download and much faster to process. Therefore, it is the preferred format to use with Osm2GpsMid. However, it is not yet widely available from all sources of planet extracts.

Generate a new bundle

The easiest way to create a bundle with your region, is to put all files (Osm2GpsMid, .osm and .properties files) in one directory.

Osm2GpsMid in addition to using a .properties configuration file, Osm2GpsMid now also supports specifying these options on a GUI. By simply running Osm2GpsMid without any further parameters, it will open the GUI and allow you to select options there.

Create the location config file.

This file describes the area and the name of the bundle.

example file mylocation.properties (the extension .properties is required)

bundle.name = south-germany
region.1.lat.min = 49.1
region.1.lat.max = 50.51
region.1.lon.min = 6.33
region.1.lon.max = 13.28
region.2.lat.min = 47.4
region.2.lat.max = 49.11
region.2.lon.min = 7.5
region.2.lon.max = 13.8
region.3.lat.min = 44.25
region.3.lat.max = 47.41
region.3.lon.min = 9.9
region.3.lon.max = 11.32
You can have up to 9 regions. The numbers have to be in ascending order and continuous. All ways in any of the regions will written to the bundle.

Optional properties


#To choose a different build use the property app
#default a generic distribution without locationProvider api

app=GpsMid-Generic-full
#app=GpsMid-Generic-full-nolocation
#app=GpsMid-Generic-minimal
#app=GpsMid-Generic-minimal-bt
#app=GpsMid-Generic-no-obex
#app=GpsMid-Generic-no-xml
#app=GpsMid-Generic-multi

#Allows you to specify which file you would like to use for your style file
style-file = style-file.xml

#pre-calculation of routing can be disabled
#to save more space in the Midlet. This will
#completely disable routing though
useRouting=true

#If you want to be able to edit OpenStreetMap data directly
#from your phone, then you need to enable this setting.
#Due to the limited interface available on the phone, this is
#not a full blown editor, but can be used to add and correct some basic
#properties. Editing will need to connect to the internet on your phone
#Also enabling this option will increase the size of the map slightly, as
#it needs to store the OSM id for every way and node.
EnableEditing=true


#new since 0.2.31 choose any name for the midlet
# you can then have 2 versions with different locations
# on your phone.
midlet.name=GpsMid

Creating a style file

It is possible to specify which OSM features get included in GpsMid and how to render them. This is done by creating a style file. There is a default style file included, so you don't need this to begin with, but if you want to customize GpsMid it will give you the required flexibility. For more details of how to customize your style-file check out the wiki.

Start the converter

start a command line, switch the working directory to the file location and run the converter with:

java -Xmx1024M -jar Osm2GpsMid-0.7.1-map65.jar planet.osm.pbf mylocation

The first argument to Osm2GpsMid is the location of your osm, osm.bz2 or osm.pbf file, the second defines your properties file. Note that the .properties is left out, as the file extension is auto-completed.

Using ROMA (Read-Only map API)

If you can't use one of the available extracts, either because you need more up-to-date data for editing, or because you need a cross country extract, you can download a small region from a database server directly. then the first parameter to Osm2GpsMid has to be roma.

java -Xmx1024M -jar Osm2GpsMid-0.7.1-map65.jar roma mylocation

Currently using osmXapi is only supported if there is a single region in the .properties file. If you want to use several regions, then you have to use .osm files stored locally as described above.

Note: This method can be slow, is often not reliable, and drains resources from foreign projects. It also only works for very small regions. So please, if you can, avoid this method and use planet extracts instead. As the servers used are not production services and outside of our control, they can stop working without notice.




Warning: Conversion with Osm2GpsMid currently uses up large amounts of memory and can take a while, so it is probably recommended to start with a smaller area and try that out first.

Due to the large memory requirements of Osm2GpsMid it is recommended or necessary to tune the jvm. The two main parameters recommended are setting the maximum allowed memory with -Xmx switch depending on your hardware and the size of area you are converting and to optimize the garbage collection to reduce memory overhead with -XX:NewRatio=32 java -Xmx1024M --XX:NewRatio=32 -jar Osm2GpsMid-0.7.1-map65.jar

Although Osm2GpsMid can directly handle bzip2 and therefore there is no need to decompress the planet before using, the java implementation of bzip2 is slightly slower than some native implementations. In Linux you can use named pipes to decompress with bzcat without needing the space to store the decompressed osm file. Handling of the .osm.pbf file format is much faster even than using uncompressed .osm files, which is now the recommended way.

Webcounter

Last updated: 22/01/11 --- GpsMid is licensed under GPLv2 --- OpenStreetMap.org data is CC-BY-SA