GpsMid is an excellent navigation software for Java smartphones. It is not only free and open-source by itself, but also uses the free map data from OpenStreetMap. Software and map data – packed in a JAR file as MIDlet – can be uploaded from the PC to the mobile phone; as long as one doesn't reload further data from there, no charge for mobile connections will accrue. Furthermore, the program can be used without GPS device also – even though the name suggests something else; in this case, one has to do the navigation manually, what will be mitigated by the fact that the on-location navigation is only a special case of general map use anyway.
So, how do I get the map on the smartphone? The simplest way is to use one of the ready-to-use packages from the GpsMid project page. If you find one that is in accordance with your needs, just download the corresponding JAR and optionally JAD file to your PC, copy them to the phone, install them there and you are through. (How to install software on a smartphone depends on the model and is not discussed here further.)
But what if just my desired region is not there or the operation system of the mobile phone refuses to install the JAR file? The latter can happen even if the memory card has enough capacity, because often there are limitations on the size of a single JAR file to be installed. So, if this way fails, on your PC you can create your own MIDlet consisting of a JAR and corresponding JAD file that contains the appropriate map region; it is also possible to include several regions in one file.
For that, first of all you have to have the following on your PC:
-
The Java Runtime Environment (JRE), at least version 1.5.
-
The program Osm2GpsMid from the GpsMid download page (the current version of the file is Osm2GpsMid-0.6.jar at the time of this writing).
-
An OSM file that contains OpenStreetMap XML data at least for the desired region. The Osm2GpsMid project page refers to some available download sources. I made good experiences by myself with Geofabrik.
-
A properties file that controls the generation of the resulting map material by Osm2GpsMid. That configuration file is required to have the filename extension .properties. You have to create this file manually, should the occasion arise by a template. How to do that will be explained immediately.
The most important setting in the .properties file is the desired region. You define it by specifying the minimum and maximum values for the latitude and longitude, respectively; for example
bundle.name = berlin
region.1.lat.min = 52.5008
region.1.lat.max = 52.5406
region.1.lon.min = 13.4047
region.1.lon.max = 13.4671
One can specify up to 9 regions serially one after the other that will be extracted from the raw data downloaded according to item 3. The best way to gain the needed values for latitude and longitude is to go to openstreetmap.org, choose the desired region there, click on Export, adjust the area again manually if needed and then look for the area data displayed: bottom and top for the latitude degrees (lat), left and right for the longitude degrees (lon), respectively. Of course, the export itself is not to be performed at this place, you just need the numbers. In case the JAR file resulting at the end of the following procedure should come out to be too big as mentioned above, one should choose a smaller region; if nothing else helps, one may divide the region on several MIDlets (see below).
Other settings that may (optionally) be taken in the .properties file, do concern special target systems (app), the specification of a style file (style-file) or the option to switch on and off routing or editing (useRouting and EnableEditing); more on this is described on the Osm2GpsMid project page. Most of these settings have influence on the size of the resulting JAR file.
A useful eventuality finally is given by the setting midlet.name. By this you can specify a dedicated name for the resulting MIDlet (instead of the default GpsMid). This allows for uploading multiple instances of the program with different map data to the mobile phone, e. g.,
midlet.name=GpsMidBerlin
An example for a full .properties file (optimized for small size) is given in the attachment. Using the raw data of berlin.osm.bz2 from the download page for Germany of the Geofabrik (cf. item 3 above) and in accordance with the procedure described below, it produces a file GpsMidBerlin-0.6.jar with a size close to 800 KiB.
Now, after you have all required prerequisites collected, copy the files you got from item 2 to 4 in a directory on your PC. This directory should then contain:
- The Java archive Osm2GpsMid-0.6.jar (or a newer version of it, if available).
- An OSM file containing the map region(s) to be generated (for this example berlin.osm.bz2).
- The configuration file created, e. g., berlin.properties from the attachment (in case adjusted to your own needs).
From this directory call the command
java -Xmx1024M -jar Osm2GpsMid-0.6.jar berlin.osm.bz2 berlin
It starts – for this example – the program Osm2GpsMid to generate a MIDlet for map navigation from the raw data of berlin.osm.bz2 configured by the data in berlin.properties; the parameter -X allocates (hopefully) enough memory for the Java machine.
The result will be – for this example again – two files, GpsMidBerlin-0.6.jad and GpsMidBerlin-0.6.jar, that can be uploaded to and installed on the smartphone as described above.
Attachment | Size |
---|---|
berlin.properties | 1.28 KB |