2019-07-21 16:48:31 +00:00
|
|
|
OCitySMap installation instructions
|
|
|
|
===================================
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
These instructions refer to software dependencies by using Ubuntu Bionic (18.04LTS)
|
|
|
|
package names. Minor adaptations might be needed for other distributions or for the
|
|
|
|
precise Debian or Ubuntu release you are using. They have been tested on several
|
|
|
|
x86_64 hosts.
|
2019-07-21 16:48:31 +00:00
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
If you are fine with running OCitySMap and MapOSMatic in a Vagrant virtual machine,
|
|
|
|
plese have a look at the MapOSMatic Vagrant repository:
|
2019-07-21 21:18:33 +00:00
|
|
|
|
|
|
|
https://github.com/hholzgra/maposmatic-vagrant
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
Note that this is mostly usefuly for personal development and small local test setups
|
|
|
|
only. For hosting a public service a Vagrant/Virtualbox virtualization setup may not
|
|
|
|
be stable and performant enough though.
|
|
|
|
|
|
|
|
ITs provisioning shell scripts may also help as a guide to install things on a
|
|
|
|
non-virtual machine though.
|
2019-07-21 21:18:33 +00:00
|
|
|
|
2019-07-21 16:48:31 +00:00
|
|
|
## Installation of required packages
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
sudo apt-get --yes install postgresql postgresql-contrib postgis osm2pgsql \
|
|
|
|
python3-mapnik python3-cairo python3-psycopg2 \
|
|
|
|
python3-shapely python3-natsort python3-colour \
|
|
|
|
python3-gdal python3-pluginbase python3-gpxpy \
|
2022-04-13 06:44:23 +00:00
|
|
|
python3-gi-cairo gir1.2-pango-1.0 gir1.2-rsvg-2.0 \
|
|
|
|
python3-qrcode python3-pip
|
|
|
|
|
|
|
|
sudo pip3 install utm
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Creation of a new PostgreSQL user
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
sudo --user=postgres createuser --pwprompt --superuser --createdb maposmatic
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
Enter the password twice (we later use ``secret`` as example password).
|
|
|
|
|
|
|
|
## Creation of the database
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
sudo --user=postgres createdb --encoding=UTF8 --locale=en_US.UTF-8 \
|
|
|
|
--template=template0 --owner=maposmatic maposmatic
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
(see also http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS)
|
|
|
|
|
|
|
|
You can now try to connect to the database, using:
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
psql --host=localhost --username=maposmatic maposmatic
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
If it doesn't work, fix your configuration.
|
|
|
|
|
|
|
|
## Enable PostGIS and Hstore extensions on the database
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
echo "CREATE EXTENSION postgis;" | sudo --user=postgres psql --dbname=maposmatic
|
|
|
|
echo "ALTER TABLE geometry_columns OWNER TO maposmatic;" | sudo --user=postgres psql --dbname=maposmatic
|
|
|
|
echo "ALTER TABLE spatial_ref_sys OWNER TO maposmatic;" | sudo --user=postgres psql --dbname=maposmatic
|
|
|
|
echo "CREATE EXTENSION hstore;" | sudo --user=postgres psql --dbname=maposmatic
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Download OSM data
|
|
|
|
|
|
|
|
We use the Luxembourg country extract here, using the country extrat server provided by GeoFabrik, Germany:
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
wget http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Import the OSM data with ``osm2pgsql``
|
|
|
|
|
|
|
|
``` bash
|
2019-08-24 14:00:20 +00:00
|
|
|
osm2pgsql --create --slim --database=maposmatic --merc --username=maposmatic \
|
|
|
|
--password --host=localhost --hstore-all luxembourg-latest.osm.pbf
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
If you have a lot of RAM, remove ``--slim``, it will make the import faster. If you
|
|
|
|
miss RAM (and have a lot of time available) you can also use the ``--cache`` option
|
|
|
|
together with ``-s``. (See also ``osm2pgsql -h``).
|
2019-07-21 16:48:31 +00:00
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
If you want to add other OSM DB files, replace the ``--create`` option with the
|
|
|
|
``--append`` option for the subsequent files you are adding: if you keep the
|
|
|
|
``--create`` option, it will erase and overwrite any previous GIS data you may
|
|
|
|
have. For example:
|
2019-07-21 16:48:31 +00:00
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
wget http://download.geofabrik.de/europe/france/ile-de-france-latest.osm.pbf
|
|
|
|
|
|
|
|
osm2pgsql --append --slim --database=maposmatic --merc --username=maposmatic \
|
|
|
|
--password --host=localhost --hstore-all ile-de-france-latest.osm.pbf
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Install Openstreetmap Carto style
|
|
|
|
|
2019-07-21 21:15:54 +00:00
|
|
|
TODO, for now please refer to the original OSM Carto install file:
|
|
|
|
|
|
|
|
https://github.com/gravitystorm/openstreetmap-carto/blob/master/INSTALL.md
|
2019-07-21 16:48:31 +00:00
|
|
|
|
|
|
|
## Installation of OCitySMap
|
|
|
|
|
|
|
|
### Download the source dode
|
|
|
|
|
|
|
|
If you have `git` installed, you can clone the project repository directly:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone git://git.savannah.nongnu.org/maposmatic/ocitysmap.git
|
|
|
|
cd ocitysmap
|
|
|
|
```
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
Or you can download the project source code as a ZIP archive from GitHub without
|
|
|
|
having to have `git` installed:
|
2019-07-21 16:48:31 +00:00
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
wget https://codeload.github.com/hholzgra/ocitysmap/zip/master --output-document=ocitysmap.zip
|
2019-07-21 16:48:31 +00:00
|
|
|
unzip ocitysmap.zip
|
|
|
|
cd ocitysmap-master
|
|
|
|
```
|
|
|
|
|
|
|
|
### Configuration file
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
Create a ``~/.ocitysmap.conf`` configuration file, modeled after the provided
|
|
|
|
``ocitysmap.conf.dist`` file:
|
2019-07-21 16:48:31 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
cp ocitysmap.conf.dist ~/.ocitysmap.conf
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run the OCitySMap renderer on the command line
|
|
|
|
|
|
|
|
E.g. for the example data imports above:
|
|
|
|
|
|
|
|
```bash
|
2019-08-24 14:00:20 +00:00
|
|
|
./render.py --title="Ceci n'est pas Paris" --osmid=-411354 # Contern, LU
|
|
|
|
./render.py --title "Ceci n'est pas Paris" --osmid=-943886 # Chevreuse, FR
|
2019-07-21 16:48:31 +00:00
|
|
|
```
|
|
|
|
|
2019-08-24 14:00:20 +00:00
|
|
|
The osmid is given as a negative number here as we are referring
|
|
|
|
to adminstrative boundary relations that have been converted to
|
|
|
|
single object polygon ways during the import.
|
|
|
|
|
2019-07-21 16:48:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Appendix A: Installation of maposmatic-printable stylesheet
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
|
|
|
a. Copy stylesheet/maposmatic-printable/symbols/* (i.e. all files in symbols/ directory) into mapnik2-osm/symbols/ directory.
|
|
|
|
|
|
|
|
b. Add absolute path to file stylesheet/maposmatic-printable/osm.xml into ~/.ocitysmap.conf.
|
|
|
|
|
|
|
|
c. Configure the stylesheet with database parameters and relevant directories:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd stylesheet/maposmatic-printable/
|
|
|
|
|
|
|
|
python ./generate_xml.py --dbname maposmatic --host 'localhost' \
|
|
|
|
--user maposmatic --port 5432 \
|
|
|
|
--password 'secret' \
|
|
|
|
--world_boundaries mapnik2-osm/world_boundaries \
|
|
|
|
--symbols mapnik2-osm/symbols
|
|
|
|
```
|
|
|
|
|