How to create your own vector offline maps?
I am preparing for the upcoming photo workshop in winter’s Scotland now. Because I recently switch from Nokia N900 to Samsung Galaxy S Duos, I also wanted to update my navigation toolset. I installed popular Locus application on my handset and tried to use it with up-to-date vector Openstreetmap maps.I supposed it would be easy, however following procedures available in tools documentation, several forums and various web articles lead to many errors, mainly in the configuration, all of those must be solved before starting conversion. The following procedure consists, as I hope, from error-proof steps :o)
- Download Openstreetmap for your region from a kindly donated server GeoFabric, like http://download.geofabrik.de/openstreetmap/europe/czech_republic.osm.pbf for the Czech Republic. Alternatively, you can use CloudMade, however maps there are OSM XML extracts meaning they have bigger size and you also need to modify osmosis command below in the step 11 accordingly.
- Download the Osmosis tool, the best working version is 0.40, latest version does not seem working well at this time.
- Unpack Osmosis zip package anywhere you like, for instance into folder D:Toolsosmosis-0.40.
- Add bin subfolder (for instance D:Toolsosmosis-0.40bin) to the Path system variable.
- Change settings of variables JAVACMD, JAVACMD_OPTIONS and PLEXUS_OPTIONS contained in osmosis.bat located in /bin subfolder in the following way:
- set JAVACMD=java
- set JAVACMD_OPTIONS=”-Xmx6G“
- set PLEXUS_CP=%MYAPP_HOME%libdefaultplexus-classworlds-2.4.jar
- Download plugin mapsforge-map-writer.jar and put it into subfolder libdefault of Osmosis root folder, for instance put plugin into D:Toolsosmosis-0.40libdefault.
- Create osmosis-plugins.conf file into subfolder conf of Osmosis root and put org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader into it.
- Download poly2bb.pl. Change the last command (_printf_) of poly2bb.pl to printf “%f,%f,%f,%f”, $miny, $minx, $maxy, $maxx;
- Download .poly file from GeoFabric or CloudMade, like http://download.geofabrik.de/clipbounds/clipbounds.tgz or http://downloads.cloudmade.com/europe/eastern_europe/czech_republic/czech_republic.poly for the Czech Republic.
- Get bounding box definition by running this: poly2bb.pl czech_republic.poly. You should finish with output similar to the following: 48.542920,12.084770,51.064260,18.863210. Remember it.
- Convert OSM binary map to the vector maps running by the following command:
osmosis -v –read-pbf czech_republic.osm.pbf –buffer –mapfile-writer file=czech_republic.osm.map bbox=48.542920,12.084770,51.064260,18.863210 type=hd
or in case of maps source from CloudMade:
osmosis -v –read-xml czech_republic.osm –buffer –mapfile-writer file=czech_republic.osm.map bbox=48.540841,12.085860,51.054381,18.862533 type=hd
- Now wait several hours for output depending on the speed and power of your system. Copy .map file to /extSdCard/Locus/mapsVector and enjoy it.
Heh, it took me several days to gather all pieces together.