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

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

Added references to osm wiki.

File size: 5.5 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
36Further reading:
37- http://wiki.openstreetmap.org/wiki/Mapnik
38- http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS
39
40This quickstart guide was tested on a Ubuntu 12.04 machine using
41- mapnik 2.1.0
42- osm2pgsql SVN version 0.81.0
43- postgresql-9.1
44
45Recommended packages that should be installed:
46
47- from Ubuntu repository:
48  postgis postgresql postgresql-9.1-postgis
49 
50- from ppa:mapnik/v2.1.0:
51  libmapnik mapnik-utils python-mapnik
52 
53- from ppa:kakrueger/openstreetmap
54  osm2pgsql
55
56The working directory is "/home/USERNAME/osm".
57In addition to this repository, the mapnik repository is required for tile
58generation:
59
60    svn co http://svn.openstreetmap.org/applications/rendering/mapnik
61    svn co http://svn.openstreetmap.org/applications/rendering/mapnik-german
62
63
64Set up world_boundaries
65-----------------------
66
67The mapnik world_boundaries have to be downloaded. For more information,
68read "mapnik/README".
69
70    cd mapnik
71    ./get-coastlines.sh
72
73These shapefiles are also needed by mapnik, but ./get-coastlines does not
74take care of them. Unpack those files to the "mpanik/world_boundaries" directory.
75- http://www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip
76
77mapnik-german requires land-polygons files that need to be extracted to the
78"mapnik/world_boundaries" directory as well. It is important that the
79Mercator projection is used and NOT the WGS84 projection:
80- http://openstreetmapdata.com/data/land-polygons
81or
82- http://data.openstreetmapdata.com/land-polygons-split-3857.zip
83
84
85Setup database
86--------------
87
88Download and extract a file containing OSM data. The planet file is large,
89so we will use the smaller sachsen.osm from:
90- http://downloads.cloudmade.com/europe/western_europe/germany/sachsen/sachsen.osm.bz2
91
92Setup your OSM database by e.g. installing the package
93"openstreetmap-postgis-db-setup" or by issuing these commands:
94
95    sudo -u postgres createdb -E UTF8 -O postgres osm
96    sudo -u postgres createlang plpgsql osm
97    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
98    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
99
100We assume that there is a database named "osm" to which the user "postgres"
101has full access. The associated password of the user "postgres" is "USERPWD".
102
103Once the database is set-up (which should already be the case if you have
104been using mapnik before), mport sachsen.osm using osm2pgsql with the
105--hstore (-k) option:
106
107    osm2pgsql -m -d osm --hstore -W \
108              -S ./mapnik-german/views/default.style \
109              ./sachsen.osm
110
111Create the views (view_osmde_*) for the mapnik-german style:
112
113    sudo -u postgres psql osm < ./mapnik-german/views/view-line.sql
114    sudo -u postgres psql osm < ./mapnik-german/views/view-point.sql
115    sudo -u postgres psql osm < ./mapnik-german/views/view-polygon.sql
116    sudo -u postgres psql osm < ./mapnik-german/views/view-roads.sql
117   
118    sudo -u postgres psql -d osm
119    SELECT populate_geometry_columns();
120
121
122Generate XML file
123-----------------
124
125At this point, everything is set and we can generate the osm-local.xml file
126(Replace /home/USERNAME/osm and USERPWD):
127
128    ./mapnik/generate_xml.py \
129      --host 'localhost' \
130      --port 5432 \
131      --dbname osm \
132      --prefix view_osmde \
133      --user postgres \
134      --password 'USERPWD' \
135      --inc /home/USERNAME/osm/mapnik-german/inc-de \
136      --world_boundaries /home/USERNAME/osm/mapnik/world_boundaries \
137      /home/USERNAME/osm/mapnik-german/osm-de.xml > /home/USERNAME/osm/mapnik-german/osm-local.xml
138
139
140Generate tiles
141--------------
142
143The "mapnik/generate_tiles.py" script must be edited to point to the correct
144"osm-local.xml" file. Create a copy in "mapnik-german" and modify it according
145to your wishes.
146
147    cp ./mapnik/generate_tiles.py ./mapnik-german/
148
149Find the line
150
151    mapfile = home + "/svn.openstreetmap.org/applications/rendering/mapnik/osm-local.xml"
152
153and replace it with
154
155    mapfile = home + "/osm/mapnik-german/osm-local.xml".
156
157Then you only need to setup a region of interest (which must be in
158Saxony in this case, because we only used sachsen.osm), e.g.
159
160    # Leipzig
161    bbox = (12.3086,51.2834,12.4353,51.3678)
162    render_tiles(bbox, mapfile, tile_dir, 7, 17 , "Leipzig")
163
164Run the script to generate the tiles:
165
166    ./mapnik-german/generate_tiles.py
Note: See TracBrowser for help on using the repository browser.