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

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

to illustrate the fact, that this function can be used for any latin script
rename function get_germanified_name to get_localized_name

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
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) option:
105
106    osm2pgsql -m -d osm --hstore -W \
107              -S ./mapnik-german/views/default.style \
108              ./sachsen.osm
109
110Create the views (view_osmde_*) for the mapnik-german style:
111
112    sudo -u postgres psql osm < ./mapnik-german/views/view-line.sql
113    sudo -u postgres psql osm < ./mapnik-german/views/view-point.sql
114    sudo -u postgres psql osm < ./mapnik-german/views/view-polygon.sql
115    sudo -u postgres psql osm < ./mapnik-german/views/view-roads.sql
116    sudo -u postgres psql osm < ./mapnik-german/views/get_localized_name.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.