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

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

Found some typies.

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