Skip to content

Commit 5539f69

Browse files
committed
Fix problems
1 parent 7f8b530 commit 5539f69

File tree

5 files changed

+139
-232
lines changed

5 files changed

+139
-232
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ RUN echo "deb http://ppa.launchpad.net/mapnik/nightly-2.3/ubuntu trusty main">>/
2323
RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4F7B93595D50B6BA
2424
RUN apt-get update
2525

26-
RUN apt-get -y install mapnik-input-plugin-gdal mapnik-input-plugin-ogr mapnik-input-plugin-postgis mapnik-input-plugin-sqlite mapnik-input-plugin-osm python-pip ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-unifont osm2pgsql
26+
RUN apt-get -y install mapnik-input-plugin-gdal mapnik-input-plugin-ogr mapnik-input-plugin-postgis mapnik-input-plugin-sqlite mapnik-input-plugin-osm python-pip ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-unifont osm2pgsql curl bzip2
2727

2828
COPY default.style /usr/share/osm2pgsql/default.style
2929

3030
RUN npm install -g https://github.com/gisce/carto/archive/extends_zoom_level.tar.gz
3131
RUN pip install https://github.com/TileStache/TileStache/archive/master.zip sympy Blit uwsgi mapnik
3232
EXPOSE 5432
3333

34+
ADD update.sh /update.sh
35+
RUN chmod 777 /update.sh
36+
3437
ADD start.sh /start.sh
3538
ADD start_tilestache.py /start_tilestache.py
3639
ADD mapserver.cfg /mapserver.cfg

default.style

Lines changed: 125 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -1,227 +1,125 @@
1-
# This is the default osm2pgsql .style file that comes with osm2pgsql.
2-
#
3-
# A .style file has 4 columns that define how OSM objects end up in tables in
4-
# the database and what columns are created. It interacts with the command-line
5-
# hstore options.
6-
#
7-
# Columns
8-
# =======
9-
#
10-
# OsmType: This is either "node", "way" or "node,way" and indicates if this tag
11-
# applies to nodes, ways, or both.
12-
#
13-
# Tag: The tag
14-
#
15-
# DataType: The type of the column to be created. Normally "text"
16-
#
17-
# Flags: Flags that indicate what table the OSM object is moved into.
18-
#
19-
# There are 5 possible flags. These flags are used both to indicate if a column
20-
# should be created, and if ways with the tag are assumed to be areas. The area
21-
# assumptions can be overridden with an area=yes/no tag
22-
#
23-
# polygon - Create a column for this tag, and objects the tag with are areas
24-
#
25-
# linear - Create a column for this tag
26-
#
27-
# phstore - Don't create a column for this tag, but objects with the tag are areas
28-
#
29-
# delete - Drop this tag completely and don't create a column for it. This also
30-
# prevents the tag from being added to hstore columns
31-
#
32-
# nocache - Deprecated and does nothing
33-
#
34-
# If an object has a tag that indicates it is an area or has area=yes/1,
35-
# osm2pgsql will try to turn it into an area. If it succeeds, it places it in
36-
# the polygon table. If it fails (e.g. not a closed way) it places it in the
37-
# line table.
38-
#
39-
# Nodes are never placed into the polygon or line table and are always placed in
40-
# the point table.
41-
#
42-
# Hstore
43-
# ======
44-
#
45-
# The options --hstore, --hstore-match-only, and --hstore-all interact with
46-
# the .style file.
47-
#
48-
# With --hstore any tags without a column will be added to the hstore column.
49-
# This will also cause all objects to be kept.
50-
#
51-
# With --hstore-match-only the behavior for tags is the same, but objects are
52-
# only kept if they have a non-NULL value in one of the columns.
53-
#
54-
# With --hstore-all all tags are added to the hstore column unless they appear
55-
# in the style file with a delete flag, causing duplication between the normal
56-
# columns and the hstore column.
57-
#
58-
# Special database columns
59-
# ========================
60-
#
61-
# There are some special database columns that if present in the .style file
62-
# will be populated by osm2pgsql.
63-
#
64-
# These are
65-
#
66-
# z_order - datatype int4
67-
#
68-
# way_area - datatype real. The area of the way, in the units of the projection
69-
# (e.g. square mercator meters). Only applies to areas
70-
#
71-
# osm_user, osm_uid, osm_version, osm_timestamp - datatype text. Used with the
72-
# --extra-attributes option to include metadata in the database. If importing
73-
# with both --hstore and --extra-attributes the meta-data will end up in the
74-
# tags hstore column regardless of the style file.
75-
76-
# OsmType Tag DataType Flags
77-
node,way access text linear
78-
node,way addr:housename text linear
79-
node,way addr:housenumber text linear
80-
node,way addr:interpolation text linear
81-
node,way admin_level text linear
82-
node,way aerialway text linear
83-
node,way aeroway text polygon
84-
node,way amenity text polygon
85-
node,way area text # hard coded support for area=1/yes => polygon is in osm2pgsql
86-
node,way barrier text linear
87-
node,way bicycle text
88-
node,way brand text linear
89-
node,way bridge text linear
90-
node,way boundary text linear
91-
node,way building text polygon
92-
node capital text linear
93-
node,way construction text linear
94-
node,way covered text linear
95-
node,way culvert text linear
96-
node,way cutting text linear
97-
node,way denomination text linear
98-
node,way disused text linear
99-
node ele text linear
100-
node,way embankment text linear
101-
node,way foot text linear
102-
node,way generator:source text linear
103-
node,way harbour text polygon
104-
node,way highway text linear
105-
node,way historic text polygon
106-
node,way horse text linear
107-
node,way intermittent text linear
108-
node,way junction text linear
109-
node,way landuse text polygon
110-
node,way layer text linear
111-
node,way leisure text polygon
112-
node,way lock text linear
113-
node,way man_made text polygon
114-
node,way military text polygon
115-
node,way motorcar text linear
116-
dnode,way name text linear
117-
dnode,way name:ca text linear
118-
node,way natural text polygon # natural=coastline tags are discarded by a hard coded rule in osm2pgsql
119-
node,way office text polygon
120-
node,way oneway text linear
121-
node,way operator text linear
122-
node,way place text polygon
123-
node poi text
124-
node,way population text linear
125-
node,way power text polygon
126-
node,way power_source text linear
127-
node,way public_transport text polygon
128-
node,way railway text linear
129-
node,way ref text linear
130-
node,way religion text nocache
131-
node,way route text linear
132-
node,way service text linear
133-
node,way shop text polygon
134-
node,way sport text polygon
135-
node,way surface text linear
136-
node,way toll text linear
137-
node,way tourism text polygon
138-
node,way tower:type text linear
139-
way tracktype text linear
140-
node,way tunnel text linear
141-
node,way water text polygon
142-
node,way waterway text polygon
143-
node,way wetland text polygon
144-
node,way width text linear
145-
node,way wood text linear
146-
node,way z_order int4 linear # This is calculated during import
147-
way way_area real # This is calculated during import
148-
149-
# Area tags
150-
# We don't make columns for these tags, but objects with them are areas.
151-
# Mainly for use with hstore
152-
way abandoned:aeroway text phstore
153-
way abandoned:amenity text phstore
154-
way abandoned:building text phstore
155-
way abandoned:landuse text phstore
156-
way abandoned:power text phstore
157-
way area:highway text phstore
158-
159-
# Deleted tags
160-
# These are tags that are generally regarded as useless for most rendering.
161-
# Most of them are from imports or intended as internal information for mappers
162-
# Some of them are automatically deleted by editors.
163-
# If you want some of them, perhaps for a debugging layer, just delete the lines.
164-
165-
# These tags are used by mappers to keep track of data.
166-
# They aren't very useful for rendering.
167-
node,way note text delete
168-
node,way note:* text delete
169-
node,way source text delete
170-
node,way source_ref text delete
171-
node,way source:* text delete
172-
node,way attribution text delete
173-
node,way comment text delete
174-
node,way fixme text delete
175-
176-
# Tags generally dropped by editors, not otherwise covered
177-
node,way created_by text delete
178-
node,way odbl text delete
179-
node,way odbl:note text delete
180-
node,way SK53_bulk:load text delete
181-
182-
# Lots of import tags
183-
# TIGER (US)
184-
node,way tiger:* text delete
185-
186-
# NHD (US)
187-
# NHD has been converted every way imaginable
188-
node,way NHD:* text delete
189-
node,way nhd:* text delete
190-
191-
# GNIS (US)
192-
node,way gnis:* text delete
193-
194-
# Geobase (CA)
195-
node,way geobase:* text delete
196-
# NHN (CA)
197-
node,way accuracy:meters text delete
198-
node,way sub_sea:type text delete
199-
node,way waterway:type text delete
200-
201-
# KSJ2 (JA)
202-
# See also note:ja and source_ref above
203-
node,way KSJ2:* text delete
204-
# Yahoo/ALPS (JA)
205-
node,way yh:* text delete
206-
207-
# osak (DK)
208-
node,way osak:* text delete
209-
210-
# kms (DK)
211-
node,way kms:* text delete
212-
213-
# ngbe (ES)
214-
# See also note:es and source:file above
215-
node,way ngbe:* text delete
216-
217-
# naptan (UK)
218-
node,way naptan:* text delete
219-
220-
# Corine (CLC) (Europe)
221-
node,way CLC:* text delete
222-
223-
# misc
224-
node,way 3dshapes:ggmodelk text delete
225-
node,way AND_nosr_r text delete
226-
node,way import text delete
227-
node,way it:fvg:* text delete
1+
# This is the style file that matches the old version of osm2pgsql, which
2+
# did not make distinctions between tags for nodes and for ways. There are a
3+
# number of optimisations that can be applied here. Firstly, certain tags
4+
# only apply to only nodes or only ways. By fixing this we reduce the amount
5+
# of useless data loaded into the DB, which is a good thing. Possible
6+
# optimisations for the future:
7+
8+
# 1. Generate this file directly from the mapnik XML config, so it's always
9+
# optimal
10+
11+
# 2. Extend it so it can understand that highway=tertiary is for ways and
12+
# highway=bus_stop is for nodes
13+
14+
# Flags field isn't used much yet, expect if it contains the text "polygon"
15+
# it indicates the shape is candidate for the polygon table. In the future I
16+
# would like to be able to add directives like "nocache" which tells
17+
# osm2pgsql that it is unlikely this node will be used by a way and so it
18+
# doesn't need to be stored (eg coastline nodes). While in essence an
19+
# optimisation hack, for --slim mode it doesn't matter if you're wrong, but
20+
# in non-slim you might break something!
21+
22+
# Also possibly an ignore flag, for things like "note" and "source" which
23+
# can simply be deleted. (In slim mode this is, does not apply to non-slim
24+
# obviously)
25+
26+
# OsmType Tag DataType Flags
27+
node,way note text delete # These tags can be long but are useless for rendering
28+
node,way source text delete # This indicates that we shouldn't store them
29+
node,way created_by text delete
30+
31+
node,way access text linear
32+
node,way addr:housename text linear
33+
node,way addr:housenumber text linear
34+
node,way addr:interpolation text linear
35+
node,way admin_level text linear
36+
node,way aerialway text linear
37+
node,way aeroway text polygon
38+
node,way amenity text nocache,polygon
39+
node,way area text # hard coded support for area=1/yes => polygon is in osm2pgsql
40+
node,way barrier text linear
41+
node,way bicycle text nocache
42+
node,way brand text linear
43+
node,way bridge text linear
44+
node,way boundary text linear
45+
node,way building text polygon
46+
node capital text linear
47+
node,way construction text linear
48+
node,way covered text linear
49+
node,way culvert text linear
50+
node,way cutting text linear
51+
node,way denomination text linear
52+
node,way disused text linear
53+
node ele text linear
54+
node,way embankment text linear
55+
node,way foot text linear
56+
node,way generator:source text linear
57+
node,way harbour text polygon
58+
node,way highway text linear
59+
node,way historic text polygon
60+
node,way horse text linear
61+
node,way intermittent text linear
62+
node,way junction text linear
63+
node,way landuse text polygon
64+
node,way layer text linear
65+
node,way leisure text polygon
66+
node,way lock text linear
67+
node,way man_made text polygon
68+
node,way military text polygon
69+
node,way motorcar text linear
70+
node,way name text linear
71+
node,way name:ca text linear
72+
node,way natural text polygon # natural=coastline tags are discarded by a hard coded rule in osm2pgsql
73+
node,way office text polygon
74+
node,way oneway text linear
75+
node,way operator text linear
76+
node,way place text polygon
77+
node poi text
78+
node,way population text linear
79+
node,way power text polygon
80+
node,way power_source text linear
81+
node,way public_transport text polygon
82+
node,way railway text linear
83+
node,way ref text linear
84+
node,way religion text nocache
85+
node,way route text linear
86+
node,way service text linear
87+
node,way shop text polygon
88+
node,way sport text polygon
89+
node,way surface text linear
90+
node,way toll text linear
91+
node,way tourism text polygon
92+
node,way tower:type text linear
93+
way tracktype text linear
94+
node,way tunnel text linear
95+
node,way water text polygon
96+
node,way waterway text polygon
97+
node,way wetland text polygon
98+
node,way width text linear
99+
node,way wood text linear
100+
node,way z_order int4 linear # This is calculated during import
101+
way way_area real # This is calculated during import
102+
103+
# If you're interested in bicycle routes, you may want the following fields
104+
# To make these work you need slim mode or the necessary data won't be remembered.
105+
#way lcn_ref text linear
106+
#way rcn_ref text linear
107+
#way ncn_ref text linear
108+
#way lcn text linear
109+
#way rcn text linear
110+
#way ncn text linear
111+
#way lwn_ref text linear
112+
#way rwn_ref text linear
113+
#way nwn_ref text linear
114+
#way lwn text linear
115+
#way rwn text linear
116+
#way nwn text linear
117+
#way route_pref_color text linear
118+
#way route_name text linear
119+
120+
# The following entries can be used with the --extra-attributes option
121+
# to include the username, userid, version & timstamp in the DB
122+
#node,way osm_user text
123+
#node,way osm_uid text
124+
#node,way osm_version text
125+
#node,way osm_timestamp text

import.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

start.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ su postgres sh -c "$POSTGRES --single -D $DATADIR -c config_file=$CONF" <<< "CRE
2424

2525
#fi
2626

27+
if [ ! -d "/style/data" ];then
28+
sh -c "/style/get-shapefiles.sh"
29+
fi
2730
trap "echo \"Sending SIGTERM to postgres\"; killall -s SIGTERM postgres" SIGTERM
2831
su postgres sh -c "uwsgi --http :8080 --eval 'import TileStache; application = TileStache.WSGITileServer(\"/mapserver.cfg\")'" &
2932
su postgres sh -c "$POSTGRES -D $DATADIR -c config_file=$CONF" &

update.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
mkdir /osm
3+
set pgpassword=openstreetmap
4+
wget http://download.geofabrik.de/europe/spain-latest.osm.bz2 -O /osm/spain-latest.osm.bz2
5+
bzip2 -d /osm/spain-latest.osm.bz2
6+
chown postgres /osm/spain-latest.osm
7+
su postgres sh -c "PGPASS=openstreetmap osm2pgsql -c -d osm -s --drop /osm/spain-latest.osm -H localhost -U osm"

0 commit comments

Comments
 (0)