User:Amaroussi/Fantasy maps with OSM software
- This page is a draft that is under construction.
We all know that OpenStreetMap has to contain data that actually exists on the ground, but what if you want to use OSM technology to map your own fictional world? One might suggest using OpenGeoFiction, but the layout may not suit all objectives, especially for alternate history players and player that prefer Earth as the template.
If you want the jump straight to the instructions, click here.
- 1 Reasons
- 2 Instructions
- 2.1 Part 1: Install and refine the operating system
- 2.2 Part 2: Install the Rails Port
- 2.3 Part 3: Install the Rails Port
- 2.4 Configure Phusion Passenger
- 2.5 Configure the Rails Port
- 2.6 Install some more software
- 2.7 Install the tile server
- 2.8 Configure the tile server
- 2.9 Configure the Rails Port
- 2.10 Install Osmosis
- 2.11 Export the database to the tile server
- 2.12 Schedule regular updates to the tile server
- 3 Common tasks
- 4 Glossary
- 5 Sources
Issues with centralised fantasy world maps
- Disputes from multiple players claiming the same territory (I have seen lots of that).
- Variable technology levels and timelines.
We don’t hate OpenGeoFiction but we know no fictional map server can achieve one size fits all for the reasons above.
Issues with using graphics software for fantasy maps
- File formats not always cross-compatible.
- Limited resolution if using raster graphics software, such as Photoshop or Paint.
Issues with using JOSM alone
- Very slow when the map gets very large.
- Not possible to edit just a part of the map.
Benefits of using OSM technology for fantasy maps
- Avoid duplication of ways by combining political, geographical and demographic data into a single database.
- Use JOSM to download only the areas of the database that you need to render, edit or update.
Risks with using OSM technology for fantasy maps
- Lots of steps to install the software.
- Need to understand terminal commands to use the server, including sudo.
Editor note: write it in a way so that a majority of users get it right on the first try.
Part 1: Install and refine the operating system
The server in this tutorial uses the 64-bit version of Ubuntu 14.04.2 LTS, the same operating system that the real OpenStreetMap servers use: you can use another Linux-based operating system, but the instructions and repositories may be different. I also strongly recommend using the 64-bit version because most servers are now 64-bit capable, and 64-bit is necessary to make use of more processing power than 32-bit servers (remember that RAM cap?).
Get the Ubuntu ISO
Always get Ubuntu from the official site only: this is the safest method because some third-party distributors (albeit not all of them) may sneak in shady trackers and stuff.
- Go to the official Ubuntu website, scroll down a little and click ‘Get Ubuntu desktop’.
- Make sure you select the 64-bit version of Ubuntu 14.04.2 LTS and then click ‘Download’.
- Ubuntu may offer you an opportunity to make a donation: scroll down and click ’Not now, take me to the download’ if you just want to download Ubuntu now.
- Save the ISO file to somewhere you can find it later, such as your desktop, and name it ‘ubuntu’.
Create a Ubuntu pen drive
Click your operating system for official instructions on creating a bootable Ubuntu pen drive:
There are two ways you can install Ubuntu, depending on how many features and software that you want:
- Standard installation – This is the fastest method for users who want to install Ubuntu straight away. The downside is that it installs software that servers don’t usually have, such as games and office software: you will also have to manually install an alternative desktop, since this method will install Unity as the default desktop.
- Minimal installation – This is slower and complicated, but with this method, you can dictate what features and software go into the server, and what kind of desktop you want to use.
There are many ways to tweak Ubuntu because of varying tastes, but ensure that you:
- Choose a strong password for your account, and enable automatic login to save time when starting up.
- Disable automatic hibernation.
- Remove software that a server doesn’t need, but keep at least one internet browser for testing the server.
- Keep other software up to date.
- Address internal system errors promptly.
- If you need to repair the desktop at any point, yet avoid the extras, run the following command:
sudo apt-get install ubuntu-desktop --no-install-recommends
Part 2: Install the Rails Port
Install the dependencies
Firstly, install the dependencies for the Rails Port first by running the following command:
- sudo apt-get install ruby1.9.1 libruby1.9.1 ruby1.9.1-dev ri1.9.1 libmagickwand-dev libxml2-dev libxslt1-dev nodejs apache2 apache2-threaded-dev build-essential git-core postgresql postgresql-contrib libpq-dev postgresql-server-dev-all libsasl2-dev
Next, install one of the Ruby gems:
- sudo gem1.9.1 install bundler
Install Phusion Passenger
The configuration notes for the OpenStreetMap website at GitHub state that you should use Phusion Passenger for production-stage databases. This is where we break off from the default instructions, which were written for a testing environment.
Go to this page on the official Phusion Passenger website, and follow the instructions.
Clone the repository
After installing Passenger, I created a directory called 'opennsmap' at /srv: I set myself as the owner of the directory, so that I do not have to constantly use sudo.
- sudo mkdir /srv/opennsmap
- sudo chown -R (user) /srv/opennsmap
Next, I cloned the latest version of the Rails Port: we can edit the Rails Port files to meet our requirements later. By default, git will put the source files in a folder called 'openstreetmap-website' in /srv/opennsmap. I renamed it to 'rails' for easy reference.
- cd /srv/opennsmap
- git clone --depth=1 https://github.com/openstreetmap/openstreetmap-website.git
- mv openstreetmap-website rails
- cd rails
Part 3: Install the Rails Port
Configure Phusion Passenger
Configure the Rails Port
- Create and configure account
- Add some data
Install some more software
Install the tile server
Install the openstreetmap-carto stylesheet
Configure the tile server
Adding ‘Retina’ tile support (optional)
Configure the Rails Port
- Run the following command:
sudo apt-get install osmosis
- Confirm that you want to install Osmosis by typing
y, and then press enter.
Export the database to the tile server
You should already have added some map data to the OSM database via Rails. Here is how to export the map data from the OSM database to the GIS database.
Please note that this method replaces all existing (test) data on the GIS database with data from the OSM database: this is necessary for your first export, to synchronise the GIS database with the OSM database.
- Export map data from the OSM database by running the following command:
osmosis --read-apidb database="osm" user="osm" validateSchemaVersion="no" --write-pbf file="osm_data.pbf"
- Import map data into the GIS database by running the following command:
osm2pgsql -s -v -c -m -S /usr/local/share/osm2pgsql/default.style -d gis "osm_data.pbf"
- For Step 1, you may have to change the values in
password="password"if you use a different user and password for the OSM database. I can’t blame you if you change the default credentials, given that database breaches are a big problem these days.
Schedule regular updates to the tile server
I recommend using JOSM to edit the map on your server: iD is a new editor that still has bugs from time to time, and Potlatch is a semi-supported editor that requires Flash Player, a plugin currently affected by unpatched vulnerabilities.
Avoid using the Ubuntu Software Centre to install JOSM, because the version on their repository may be out of date. Go to this page on the official JOSM website, and follow those instructions instead.
Backup or snapshot
- Make sure the virtual machine’s tab is open, but not running.
- Click the ‘clock with the plus sign’ icon. The tool-tip should read ‘Take a snapshot of this virtual machine’.
- Type in a name for the snapshot and (optionally) a description.
- Click ‘Take Snapshot’.
- For Step 1, I prefer to take a snapshot while the virtual machine is not running, to reduce the risk of graphical glitches.
- For Step 3, I advise in using a meaningful name, otherwise it would be hard to track the progress of your installation if you have to undo changes.
Commit Rails Port changes to production server
- Just run the following command:
sudo service apache2 restart
- GIS database: the database that provides map data to the tile server.
- OSM database: the database that powers the Rails Port and the API, and holds the working map data.
- ISO file: a digital copy of a CD or DVD.
- Ubuntu: a brand of operating system that OpenStreetMap uses to run its servers.