Installation [Developer]

The following specifies software and data requirements as part of the installation. Please be aware that different steps in scenery generation (e.g. generating elevation data, generating scenery objects) might require a lot of memory and are CPU intensive. Either use decent hardware or experiment with the size of the sceneries. However it is more probable that your computer gets at limits when flying around in FlightGear with sceneries using osm2city than when generating the sceneries.

Pre-requisites

Python

osm2city is written in Python and needs Python for execution. Python is available on all major desktop operating systems — including but not limited to Windows, Linux and Mac OS X. See http://www.python.org.

Currently Python version 3.5 is used for development and is therefore the recommended version.

Python Extension Packages

osm2city uses the following Python extension packages, which must be installed on your system and be included in your PYTHONPATH:

  • matplotlib
  • networkx
  • numpy
  • pil
  • scipy
  • shapely
  • psycopg2

Please make sure to use Python 3.5+ compatible extensions. Often Python 3 compatible packages have a “3” in their name. Most Linux distributions come by default with the necessary packages — often they are prefixed with python- (e.g. python-numpy). On Windows WinPython (https://winpython.github.io/) together with Christoph Gohlke’s unofficial Windows binaries for Python extension packages (http://www.lfd.uci.edu/~gohlke/pythonlibs/) works well.

Installation of osm2city

There is no installer package - neither on Windows nor Linux. osm2city consists of a set of Python programs “osm2city” and the related data in “osm2city-data”. You need both.

Do the following:

  1. Download the packages either using Git or as a zip-package.
  2. Add the osm2city directory to your PYTHONPATH (see below).
  3. Make sure that you have set $FG_ROOT

Setting PYTHONPATH

You can read more about this at https://docs.python.org/3.5/using/cmdline.html#envvar-PYTHONPATH.

On Linux you would typically add something like the following to your .bashrc file:

PYTHONPATH=$HOME/develop_vcs/python3/osm2city
export PYTHONPATH

Setting Environment Variable $FG_ROOT

The environment variable $FG_ROOT must be set in your operating system or at least your current session, such that fgelev can work optimally. How you set environment variables is depending on your operating system and not described here. I.e. this is NOT something you set as a parameter in params.ini!

You might have to restart Windows to be able to read the environment variable that you set through the control panel. In Linux you might have to create a new console session.

$FG_ROOT is typically a path ending with directories data or fgdata (e.g. on Linux it could be /home/pingu/bin/fgfs_git/next/install/flightgear/fgdata).

Setting up a PostGIS Database

At the moment using a database instead of reading directly from OSM-files is not yet mandatory. However it is strongly recommended to do so, as most development is done using a database as the data source.

Creating and populating a PostGIS database is described in OSM Data in a PostGIS Database.

Other Tools

You might want to check out Sławek Mikuła’s scripts for osm2city parsing and generation, which make some of the repetitice manual tasks involved in generating a scenery a bit easier.