source: subversion/applications/rendering/mapnik-german/README @ 29146

Last change on this file since 29146 was 29146, checked in by skaiwalker, 7 years ago

Appended a Quickstart guide for generation of mapnik-german tiles.

File size: 5.3 KB
Line 
1German Map Style for Mapnik
2---------------------------
3
4This style closely follows the "original" Mapnik style
5(svn.openstreetmap.org/applications/rendering/mapnik). All
6instructions and helper programs from that directory apply
7equally to here, and changes made to that style could, and
8often should, be patched in here as well.
9
10This style has originally been developed by Beate Braun for her
11Bachelor Thesis at HFT Stuttgart, with support from Geofabrik
12and is now maintained by the openstreetmap community.
13
14The style is made freely available here for anyone to use, subject
15to any constraints possibly inherited from the original Mapnik style.
16
17This style is in use at http://www.openstreetmap.de/.
18
19See http://www.openstreetmap.de/germanstyle.html for more.
20
21There is a developer and maintainer mailinglist at
22mapnik-de@lists.openstreetmap.de
23
24To deploy this style use the supplied default.style file for
25osm2pgsql and import data using the hstore extension of
26PostgreSQL (--hstore --hstore-match-only switches of osm2pgsql).
27
28To keep the database compatible to the "original" Mapnik style we
29now use views instead of tables. SQL scripts to set up these views
30are supplied in the views directory.
31
32
33Quickstart
34==========
35
36This quickstart guide was tested on a Ubuntu 12.04 machine using
37- mapnik 2.1.0
38- osm2pgsql SVN version 0.81.0
39- postgresql-9.1
40
41Recommended packages that should be installed:
42
43- from Ubuntu repository:
44  postgis postgresql postgresql-9.1-postgis
45 
46- from ppa:mapnik/v2.1.0:
47  libmapnik mapnik-utils python-mapnik
48 
49- from ppa:kakrueger/openstreetmap
50  osm2pgsql
51
52The working directory is "/home/USERNAME/osm".
53In addition to this repository, the mapnik repository is required for tile
54generation:
55
56    svn co http://svn.openstreetmap.org/applications/rendering/mapnik
57    svn co http://svn.openstreetmap.org/applications/rendering/mapnik-german
58
59
60Set up world_boundaries
61-----------------------
62
63The mapnik world_boundaries have to be downloaded. For more information,
64read "mapnik/README".
65
66    cd mapnik
67    ./get-coastlines.sh
68
69These shapefiles are also needed by mapnik, but ./get-coastlines does not
70take care of them. Copy those files to the "mpanik/world_boundaries" directory.
71- ftp://195.16.220.82/pub/osm/mapnik-data-files/world_boundaries/110m_admin_0_boundary_lines_land.dbf
72- ftp://195.16.220.82/pub/osm/mapnik-data-files/world_boundaries/110m_admin_0_boundary_lines_land.shp
73
74mapnik-german requires land-polygons files that need to be extracted to the
75"mapnik/world_boundaries" directory as well. It is important that the
76Mercantor projection is used and NOT the WGS84 projection:
77- http://data.openstreetmapdata.com/land-polygons-split-3857.zip
78
79
80Setup database
81--------------
82
83Download and extract a file containing OSM data. The planet file is large,
84so we will use the smaller sachsen.osm from:
85- http://downloads.cloudmade.com/europe/western_europe/germany/sachsen/sachsen.osm.bz2
86
87Setup your OSM database by e.g. installing the package
88"openstreetmap-postgis-db-setup" or by issuing these commands:
89
90    sudo -u postgres createdb -E UTF8 -O postgres osm
91    sudo -u postgres createlang plpgsql osm
92    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
93    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
94
95We assume that there is a database named "osm" to which the user "postgres"
96has full access. The associated password of the user "postgres" is "USERPWD".
97
98Once the database is set-up. Import sachsen.osm using osm2pgsql with the
99--hstore (-k) option:
100
101    osm2pgsql -m -d osm --hstore -W \
102              -S ./mapnik-german/views/default.style \
103              ./sachsen.osm
104
105Create the views (view_osmde_*) for the mapnik-german style:
106
107    sudo -u postgres psql osm < ./mapnik-german/views/view-line.sql
108    sudo -u postgres psql osm < ./mapnik-german/views/view-point.sql
109    sudo -u postgres psql osm < ./mapnik-german/views/view-polygon.sql
110    sudo -u postgres psql osm < ./mapnik-german/views/view-roads.sql
111   
112    sudo -u postgres psql -d osm
113    SELECT populate_geometry_columns();
114
115
116Generate XML file
117-----------------
118
119At this point, everything is set and we can generate the osm-local.xml file:
120(Replace /home/USERNAME/osm and USERPWD)
121
122    ./mapnik/generate_xml.py \
123      --host 'localhost' \
124      --port 5432 \
125      --dbname osm \
126      --prefix view_osmde \
127      --user postgres \
128      --password 'USERPWD' \
129      --inc /home/USERNAME/osm/mapnik-german/inc-de \
130      --world_boundaries /home/USERNAME/osm/mapnik/world_boundaries \
131      /home/USERNAME/osm/mapnik-german/osm-de.xml > /home/USERNAME/osm/mapnik-german/osm-local.xml
132
133
134Generate tiles
135--------------
136
137The "mapnik/generate_tiles.py" script must be edited to point to the correct
138"osm-local.xml" file. Create a copy in "mapnik-german" and modify it according
139to your wishes.
140
141    cp ./mapnik/generate_tiles.py ./mapnik-german/
142
143Find the line
144
145    mapfile = home + "/svn.openstreetmap.org/applications/rendering/mapnik/osm-local.xml"
146
147and replace it with
148
149    mapfile = home + "/osm/mapnik-german/osm-local.xml".
150
151Then the only thing to do is to setup a region of interest (which must be in
152Saxony in this case, because we only used sachsen.osm), e.g.
153
154    # Leipzig
155    bbox = (12.3086,51.2834,12.4353,51.3678)
156    render_tiles(bbox, mapfile, tile_dir, 7, 17 , "Leipzig")
157
158Run the script to generate the tiles:
159
160    ./mapnik-german/generate_tiles.py
Note: See TracBrowser for help on using the repository browser.