User:Ika-chan!/Fantasy maps with OSM software

From OpenStreetMap Wiki
Jump to: navigation, search
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.


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.


I am working on partitions: the first one for the system (about 500 GB), and the other one for the database (about 1,024 GB or 1 TB)

I strongly recommend using a 64-bit operating system 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 for the latter?).


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.

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.

  1. Go to the official Ubuntu website, scroll down a little and click ‘Get Ubuntu desktop’.
  2. Make sure you select the 64-bit version of Ubuntu 14.04.2 LTS and then click ‘Download’.
  3. 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.
  4. 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:

  1. Mac instructions
  2. Ubuntu instructions
  3. Windows instructions

Install Ubuntu

There are two ways you can install Ubuntu, depending on how many features and software that you want:

  1. 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.
  2. 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.

Refine Ubuntu

There are many ways to tweak Ubuntu because of varying tastes, but ensure that you:

  1. Choose a strong password for your account, and enable automatic login to save time when starting up.
  2. Disable automatic hibernation.
  3. Remove software that a server doesn’t need, but keep at least one internet browser for testing the server.
  4. Keep other software up to date.
  5. Address internal system errors promptly.
  6. 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.[1] This is where we break off from the default instructions,[2] 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
  • 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

Install Osmosis

You should already have Osm2pgsql on your server when you used it to test the GIS database: now you need to install Osmosis to export map data from the OSM database to the GIS database.

  1. Run the following command:
    sudo apt-get install osmosis
  2. 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.

  1. 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"
  2. Import map data into the GIS database by running the following command:
    osm2pgsql -s -v -c -m -S /usr/local/share/osm2pgsql/ -d gis "osm_data.pbf"
  • For Step 1, you may have to change the values in user="user" and/or add 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

Common tasks


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.

Installing JOSM

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.

Configuring JOSM

Backup or snapshot

VMware method

  1. Make sure the virtual machine’s tab is open, but not running.
  2. Click the ‘clock with the plus sign’ icon. The tool-tip should read ‘Take a snapshot of this virtual machine’.
  3. Type in a name for the snapshot and (optionally) a description.
  4. 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.

Physical method

Commit Rails Port changes to production server

Restart Apache

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