Hardware (an example)
PC with Intel Core i5-2400 3.1GHz CPU, 8 or 12 GB DDR-3 RAM, Windows
10 64-bit operating system, 240 GB or 480 GB SSD HD.
Most important specs are: 8 GB RAM or more, 64-bit OS, SSD Hard
Drive (mechanical Hard Drive will work, but slow compared to SSD)
Software Installation:
Install Oracle VirtualBox on your PC.
For Windows 10, if the install of VirtualBox freezes up, right click
the VirtualBox installation exe, choose Properties...Compatibility
Mode=Win 8.
Invoke VirtualBox, create a new VM type=Linux, Base Memory=5120 MB,
Hard Disk type =VMDK, Dynamically allocated HD, HD Size=128 GB.
In Settings: System Processor=4, Network change from NAT to Bridged;
in Advanced Adapter Type use Intel PRO/1000 MT
Download a Ubuntu Server image (iso of approx 680 MB) http://www.ubuntu.com/download/server
In the VirtualBox Storage section, see graphics below:

click "[Optical Drive] Empty" and attach the Ubuntu Server iso image
file.
Click the Green Start arrow to start installing Ubuntu on the VM.
When asked about what hostname, I suggest osmosis (you can use any
name)

When asked about software selection, I select standard system
utilities and OpenSSH server.

Start the VM and install Ubuntu Server
After the Ubuntu server is installed
-Install java
sudo apt-get install openjdk-8-jre
-Increase Java heap space
cd ~
echo export JAVACMD_OPTIONS=-Xmx4000M > .osmosis
-Install osmosis
(sudo apt-get install osmosis may work, but I had bad experience in
the past with apt-get install osmosis, therefore I stick with the
safer method below)
cd ~
wget
http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.tgz
mkdir osmosis
tar -xvf osmosis-latest.tgz -C ~/osmosis
ifconfig to find out the IP address of your VM.
-Find and install Mapsforge Map-Writer plug-in
On your PC, go to https://github.com/mapsforge/mapsforge
scroll past the folders listing, find the icon "maven-central",
follow the link and click "mapsforge-map-writer", download (save)
the "jar-with-dependencies.jar" file. It is a java executable file.
On your PC, install Filezilla. Click File, Site Manager, New Site,
enter the Host IP address (of the VM), Protocol use sftp, Logon
Type=Normal, enter user and password, click connect.
Invoke Filezilla to sftp the
mapsforge-map-writer-0.7.0.jar-with-dependencies.jar file to your
Ubuntu-osomsis's home directory
(Filezilla remote site is /home/yourname), go back to the VM
cd ~
mkdir plugins
mv mapsforge-map-writer-0.7.0.jar-with-dependencies.jar
~/plugins
Fetch and compile OpenStreetMap data into .map format
Change your PC's automatic sleep setting to "never". If your PC goes
to sleep while the map compilation is in progress, the map
compilation will fail. For example,
If you encounter "bounding box missing" during
map compilation,
find the 4 bounding box parameters for your interested map region:
Use http://www.informationfreeway.org
to find the min Latitude, min Longitude, max Latitude, max
Longitude
min latitude: southern tip of your map
min longitude: western tip of your interested map region
max latitude: northern tip of your map
max longitude: eastern tip of your interested map region
e.g. Bounding box for Hawaii is 18,-161,23,-154 California
is 32.4,-125,42.02,-114 China is 15,73,53.7,135
cd ~
wget
http://download.geofabrik.de/north-america/us/hawaii-latest.osm.pbf
~/osmosis/bin/osmosis --rb file=hawaii-latest.osm.pbf --mw
file=hawaii.map
if you encounter "bounding box missing" error,
add the bounding box parameters:
~/osmosis/bin/osmosis --rb file=hawaii-latest.osm.pbf --mw
file=hawaii.map bbox=minLat,minLon,maxLat,maxLong
~/osmosis/bin/osmosis --rb file=hawaii-latest.osm.pbf --mw
file=hawaii.map bbox=18,-161,23,-154
Note that space is not allowed between the bounding box
parameters.
If you get OUT OF HEAP SPACE error because the region/map is too
large (approximately > 120 MB),
append a type=hd directive to
the osmosis command line
cd ~
wget
http://download.geofabrik.de/north-america/us/california-latest.osm.pbf
~/osmosis/bin/osmosis --rb file=california-latest.osm.pbf --mw
file=california.map type=hd
The final product is a file with .map extension, e.g., hawaii.map
or california.map
Use Filezilla sftp to transfer the maps to your PC.
For other regions around the world, see http://download.geofabrik.de
Transfer .maps files to Android device
It is best to copy .map files to an external micro SD card (note:
not all Android tablets/phones have external SD card)
For Locus Pro, it is best to copy .map files to
Android/data/menion.android.locus.pro/files
For recent versions of Locus Pro, I found that simply copying .map
files to SD card /maps directory works well.
There are several methods to transfer .map files to Android device:
-unmount and remove the micro-SD card and insert the micro-SD in a
USB-micro-SD card reader, or
-install and use ASUS File Manger. Click the PC File Transfer
function to transfer files over WiFi (this method is convenient), or
-use an OTG cable and a USB memory stick (some Android devices do
not have OTG hardware; and transfer speed can be slow over OTG).
Tell Locus where your maps are located
Tap Menu (3-horizontal bars), Settings, Miscellaneous, Default
Directories, Set 'mapsVector/' directory,
/storage/FIF1-C1C1/Andorid/data/menion/android.locus.pro/files
(F1F1-C1C1 is a unique label for my SD-card, your SD card will have
a different unique label) or
/storage/F1F1-C1C1/maps
Backup
Backup your Virtual Map Creator to a file (approximately 1GB file
size).
In VirtualBox, click File, Export Appliance.
Portability bonus: you can save the Appliance file on a USB stick
and use it on a friend's PC, provided it has at least 8G RAM and
64-bit OS and VirtualBox.
Polygon Extraction
If the geographic region of interest is not in download.geofabrik.de
you can extract your region of interest using the polygon extraction method.
© 2017 Nicholas Fong
nicholas.fong@gmail.com
Last updated: 2017-02-28
Disclaimer