How to create your own vector offline maps?

Posted by

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)

  1. 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.
  2. Download the Osmosis tool, the best working version is 0.40, latest version does not seem working well at this time.
  3. Unpack Osmosis zip package anywhere you like, for instance into folder D:Toolsosmosis-0.40.
  4. Add bin subfolder (for instance D:Toolsosmosis-0.40bin) to the Path system variable.
  5. Change settings of variables JAVACMD, JAVACMD_OPTIONS and PLEXUS_OPTIONS contained in osmosis.bat located in /bin subfolder in the following way:
    1. set JAVACMD=java
    2. set JAVACMD_OPTIONS=”-Xmx6G
    3. set PLEXUS_CP=%MYAPP_HOME%libdefaultplexus-classworlds-2.4.jar
  6. 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.
  7. Create osmosis-plugins.conf file into subfolder conf of Osmosis root and put org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader into it.
  8. Download poly2bb.pl. Change the last command (_printf_) of poly2bb.pl to printf “%f,%f,%f,%f”, $miny, $minx, $maxy, $maxx;
  9. 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.
  10. 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.
  11. 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

  12. 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.

3 comments

  1. I’m an architect and I’m interested in the GIS field so I did some studies about it and my information about programming isn’t good enough to understand some points in this article 😀 what do you exactly mean by step 5 is that done through the cmd of my operating system and is this syntax is what should be written or what?

    thanks in advance

    Sarah

Leave a Reply to Using Vector Maps for Outdoor Sports 向量地圖 (更適合戶外運動) | Blue Bottle Cancel reply

Your email address will not be published. Required fields are marked *