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

Last change on this file since 29843 was 29843, checked in by giggls, 6 years ago

fix documentation

File size: 5.6 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
76mapnik-german requires land-polygons files that need to be extracted to the
77"mapnik/world_boundaries" directory as well. It is important that the
78Mercator projection is used and NOT the WGS84 projection:
79- http://openstreetmapdata.com/data/land-polygons
80or
81- http://data.openstreetmapdata.com/land-polygons-split-3857.zip
82- http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip
83
84Setup database
85--------------
86
87Download and extract a file containing OSM data. The planet file is large,
88so we will use the smaller sachsen.osm from:
89- http://downloads.cloudmade.com/europe/western_europe/germany/sachsen/sachsen.osm.bz2
90
91Setup your OSM database by e.g. installing the package
92"openstreetmap-postgis-db-setup" or by issuing these commands:
93
94    sudo -u postgres createdb -E UTF8 -O postgres osm
95    sudo -u postgres createlang plpgsql osm
96    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
97    sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
98
99We assume that there is a database named "osm" to which the user "postgres"
100has full access. The associated password of the user "postgres" is "USERPWD".
101
102Once the database is set-up (which should already be the case if you have
103been using mapnik before), mport sachsen.osm using osm2pgsql with the
104--hstore (-k) and --hstore-match-only options:
105
106    osm2pgsql -m -d osm --hstore --hstore-match-only -W \
107              -S ./mapnik-german/views/default.style \
108              ./sachsen.osm
109
110Create the views (view_osmde_*) for the mapnik-german style (also
111usable for standard osm 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    sudo -u postgres psql osm < ./mapnik-german/views/get_localized_name.sql
118   
119    sudo -u postgres psql -d osm
120    SELECT populate_geometry_columns();
121
122
123Generate XML file
124-----------------
125
126At this point, everything is set and we can generate the osm-local.xml file
127(Replace /home/USERNAME/osm and USERPWD):
128
129    ./mapnik/generate_xml.py \
130      --host 'localhost' \
131      --port 5432 \
132      --dbname osm \
133      --prefix view_osmde \
134      --user postgres \
135      --password 'USERPWD' \
136      --inc /home/USERNAME/osm/mapnik-german/inc-de \
137      --world_boundaries /home/USERNAME/osm/mapnik/world_boundaries \
138      /home/USERNAME/osm/mapnik-german/osm-de.xml > /home/USERNAME/osm/mapnik-german/osm-local.xml
139
140
141Generate tiles
142--------------
143
144The "mapnik/generate_tiles.py" script must be edited to point to the correct
145"osm-local.xml" file. Create a copy in "mapnik-german" and modify it according
146to your wishes.
147
148    cp ./mapnik/generate_tiles.py ./mapnik-german/
149
150Find the line
151
152    mapfile = home + "/svn.openstreetmap.org/applications/rendering/mapnik/osm-local.xml"
153
154and replace it with
155
156    mapfile = home + "/osm/mapnik-german/osm-local.xml".
157
158Then you only need to setup a region of interest (which must be in
159Saxony in this case, because we only used sachsen.osm), e.g.
160
161    # Leipzig
162    bbox = (12.3086,51.2834,12.4353,51.3678)
163    render_tiles(bbox, mapfile, tile_dir, 7, 17 , "Leipzig")
164
165Run the script to generate the tiles:
166
167    ./mapnik-german/generate_tiles.py
Note: See TracBrowser for help on using the repository browser.