When you ask for a script I assume you are on Mac OS X, Linux, {free}{net}{open}bsd, solaris or some other linux/unix like OS.
I have two scripts: One that downloads and converts a whole bunch of osm.pbf files and one that specifically only downloads and converts netherlands.osm.pbf, as the first ran for days on a lot of osm.pbf files.
<code>
#!/bin/sh
WORK_FOLDER="/opt/OpenStreetMap"
# First download all the data
cd "$WORK_FOLDER/osm_files"
echo "Now in `pwd`\n"
rm *
wget -v -O Netherlands_europe_2.osm.pbf "
http://download.geofabrik.de/europe/netherlands-latest.osm.pbf"
#wget -v -O Luxembourg_europe_2.osm.pbf "
http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf"
#wget -v -O Belgium_europe_2.osm.pbf "
http://download.geofabrik.de/europe/belgium-latest.osm.pbf"
cd $WORK_FOLDER
echo `date` > starttime.txt
echo "Now converting from osm.pbf to osmand obf\n"
cd "$WORK_FOLDER/OsmAndMapCreator"
java -Djava.util.logging.config.file=logging.properties -Xms256M -Xmx2560M -cp "./OsmAndMapCreator.jar:./lib/OsmAnd-core.jar:./lib/*.jar" net.osmand.data.index.IndexBatchCreator ./batch.xml
cd $WORK_FOLDER
echo `date` > endtime.txt
echo "And finally moving the obf files from the index folder to the osmandmaps folder\n"
mv index_files/*.obf osmandmaps/
</code>
I have a work folder (variable in the top of the script) which contains the subfolders "osm_files", "index_files", "osmandmaps" and OsmAndMapCreator. The last contains of course the osmandmapcreator software.
You really need to run osmandmapcreator from it's own folder (unless you want to set all things in your environment which I don't want).
The luxembourg and belgium remarks give you other options as well, replace for your maps (Germany?, Austria?).
I use wget -O to give the downloaded file another name as I download the latest osm.pbf from geofabrik and want the name to be the same as OsmAnd likes it to have.
Make sure that your batch.xml contains the correct folder paths. It is the line:
<process directory_for_osm_files="/opt/OpenStreetMap/osm_files" directory_for_index_files="/opt/OpenStreetMap/index_files" directory_for_generation="/opt/OpenStreetMap/osmandmap"
If you want to leave the original batch.xml as it is your can also create a copy and modify that, e.g. mybatch.xml and specify that one in the script.
The starttime.txt and endtime.txt are just created as I want to know how long the process took.
Harry
Does someone has a script which creates an osmand map out of a .pbf file?
thanks