forked from FreemapSlovakia/freemap-mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
additional.sql
185 lines (176 loc) · 3.5 KB
/
additional.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
CREATE EXTENSION intarray;
CREATE EXTENSION hstore;
-- see https://wiki.postgresql.org/wiki/First/last_(aggregate)
-- Create a function that always returns the first non-NULL item
CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement )
RETURNS anyelement LANGUAGE SQL IMMUTABLE STRICT AS $$
SELECT $1;
$$;
-- And then wrap an aggregate around it
CREATE AGGREGATE public.FIRST (
sfunc = public.first_agg,
basetype = anyelement,
stype = anyelement
);
-- Create a function that always returns the last non-NULL item
CREATE OR REPLACE FUNCTION public.last_agg ( anyelement, anyelement )
RETURNS anyelement LANGUAGE SQL IMMUTABLE STRICT AS $$
SELECT $2;
$$;
-- And then wrap an aggregate around it
CREATE AGGREGATE public.LAST (
sfunc = public.last_agg,
basetype = anyelement,
stype = anyelement
);
-- not sure if those indexes help ;-)
create index idx_colour on osm_routes (colour);
create index idx_symbol on osm_routes ("osmc:symbol");
create index idx_network on osm_routes (network);
create index idx_type on osm_routes (type);
create index osm_features_osm_id on osm_features (osm_id);
create index osm_features_type on osm_features (type);
create index osm_places_type on osm_places (type);
drop table if exists z_order_poi;
create table z_order_poi (type varchar primary key, z_order serial);
insert into z_order_poi (type) values
('monument'),
('archaeological_site'),
('tower_observation'),
('cave_entrance'),
('arch'),
('office'),
('water_park'),
('hotel'),
('chalet'),
('hostel'),
('motel'),
('guest_house'),
('alpine_hut'),
('apartment'),
('wilderness_hut'),
('basic_hut'),
('camp_site'),
('castle'),
('forester''s_lodge'),
('guidepost'),
('cathedral'),
('temple'),
('basilica'),
('church'),
('chapel'),
('station'),
('halt'),
('bus_station'),
('museum'),
('cinema'),
('theatre'),
('free_flying'),
('bunker'),
('restaurant'),
('pub'),
('convenience'),
('supermarket'),
('fuel'),
('fast_food'),
('cafe'),
('bar'),
('pastry'),
('confectionery'),
('hospital'),
('pharmacy'),
('golf_course'),
('miniature_golf'),
('soccer'),
('tennis'),
('basketball'),
('waterfall'),
('dam'),
('weir'),
('refitted_drinking_spring'),
('drinking_spring'),
('refitted_spring'),
('spring'),
('refitted_not_drinking_spring'),
('not_drinking_spring'),
('drinking_water'),
('hot_spring'),
('water_point'),
('water_well'),
('viewpoint'),
('mine'),
('adit'),
('mineshaft'),
('disused_mine'),
('townhall'),
('memorial'),
('university'),
('college'),
('school'),
('kindergarten'),
('community_centre'),
('fire_station'),
('police'),
('post_office'),
('horse_riding'),
('picnic_shelter'),
('weather_shelter'),
('shelter'),
('lean_to'),
('hunting_stand'),
('taxi'),
('bus_stop'),
('public_transport'),
('tower_bell_tower'),
('bicycle'),
('board'),
('map'),
('artwork'),
('fountain'),
('playground'),
('wayside_shrine'),
('cross'),
('wayside_cross'),
('tree_shrine'),
('rock'),
('stone'),
('sinkhole'),
('toilets'),
('post_box'),
('telephone'),
('chimney'),
('water_tower'),
('attraction'),
('sauna'),
('tower_communication'),
('mast_communication'),
('tower_other'),
('mast_other'),
('saddle'),
('peak1'),
('peak2'),
('peak3'),
('peak'),
('water_works'),
('reservoir_covered'),
('pumping_station'),
('wastewater_plant'),
('outdoor_seating'),
('firepit'),
('bench'),
('beehive'),
('apiary'),
('waste_basket'),
('waste_disposal'),
('lift_gate'),
('swing_gate'),
('watering_place'),
('feeding_place'),
('game_feeding'),
('shopping_cart'),
('ruins'),
('building'),
('tree'),
('gate'),
('ford'),
('route_marker');