osm.pbf2obf.sh
is a script that creates a obf
file to
OsmAnd from a osm.pbf
file
using OSMAndCreator tool
- Any OS GNU/Linux (tested in Slackware Linux 14.0)
- Memory RAM +2GB
- OsmAndMapCreator tool
- OpenJDK +7
- Wget
-
Clone this repository and enter to the directory
$ git clone https://github.com/51114u9/osm.pbf2obf.git
$ cd osm.pbf2obf
-
Download OsmAndMapCreator tool from OsmAnd.net
$ wget -c http://download.osmand.net/releases/OsmAndMapCreator-1.1.3.zip
-
Unzip
OsmAndMapCreator-1.1.3.zip
file$ unzip -d OsmAndMapCreator OsmAndMapCreator-1.1.3.zip
-
Replace
batch.xml
file into OsmAndMapCreator directory$ cp batch.xml OsmAndMapCreator
Edit lines of OsmAndMapCreator/batch.xml
file and set full directory
path to github project directory, e.g.
directory_for_osm_files="/home/<user_name>/projects/github/osm.pbf2obf/osm_files"
directory_for_index_files="/home/<user_name>/projects/github/osm.pbf2obf/index_files"
directory_for_generation="/home/<user_name>/projects/github/osm.pbf2obf/gen_files"
Edit lines of osm.pbf2obf.sh
file
HOMEDIR="/home/<user_name>/projects/github/osm.pbf2obf"
OSMANDFILE="Bolivia_southamerica.osm.pbf"
SRCURL="http://download.geofabrik.de/south-america/bolivia-latest.osm.pbf"
JAVA_MMIN="256m"
JAVA_MMAX="2560m"
where:
HOMEDIR
- is the full directory path to the project clonedOSMANDFILE
- filename inside the osmand directory on the mobile device, e.g.Japan_asia.obf
,Spain_europe.obf
,Bolivia_southamerica.obf
SRCURL
- url of the ".pbf" file. Get from download.geofabrik.de, download.openstreetmap.fr or mapzen.com/metro-extractsJAVA_MMIN
- initial size of memory to java app, e.g.250m, 0.5g, 1g
JAVA_MMAX
- maximum size of memory to java app, e.g.2550m, 4096m, 2g, 4g
If you have Ubuntu based distro, replace the first line with
#!/bin/bash
-
Run script
$ sh osm.pbf2obf.sh
// POSIX distro$ bash osm.pbf2obf.sh
// Ubuntu based distro -
Go and pour yourself a cup of coffee (not instant) because it will take a few minutes ;-)
-
Once generated your
obf
file, you can copy it into theosmand
directory on your mobile device
If you want to create a new file every night, you could add a crontab line like
0 4 * * * /home/<user_name>/projects/github/osm.pbf2obf/osm.pbf2obf.sh > /dev/null 2>&1
Enjoy!
B^)
License: BSD