-
Notifications
You must be signed in to change notification settings - Fork 120
/
apply-planet_osm_polygon.sql
84 lines (58 loc) · 4.9 KB
/
apply-planet_osm_polygon.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
DO $$
BEGIN
--------------------------------------------------------------------------------
-- planet_osm_polygon
--------------------------------------------------------------------------------
UPDATE planet_osm_polygon SET
mz_landuse_min_zoom = mz_calculate_min_zoom_landuse(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_landuse(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon SET
mz_poi_min_zoom = mz_calculate_min_zoom_pois(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_pois(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon SET
mz_transit_level = mz_calculate_min_zoom_transit(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_transit(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon
SET mz_water_min_zoom = mz_calculate_min_zoom_water(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_water(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon
SET mz_boundary_min_zoom = mz_calculate_min_zoom_boundaries(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_boundaries(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon
SET mz_building_min_zoom = mz_calculate_min_zoom_buildings(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_buildings(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon
SET mz_earth_min_zoom = mz_calculate_min_zoom_earth(planet_osm_polygon.*)
WHERE mz_calculate_min_zoom_earth(planet_osm_polygon.*) IS NOT NULL;
UPDATE planet_osm_polygon
SET mz_label_placement = ST_PointOnSurface(way);
CREATE INDEX planet_osm_polygon_landuse_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_landuse_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_landuse_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_landuse_min_zoom <= 9;
CREATE INDEX planet_osm_polygon_landuse_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_landuse_min_zoom <= 12;
CREATE INDEX planet_osm_polygon_landuse_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_landuse_min_zoom <= 15;
CREATE INDEX planet_osm_polygon_transit_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_transit_level IS NOT NULL;
CREATE INDEX planet_osm_polygon_transit_geom_6_index ON planet_osm_polygon USING gist(way) WHERE mz_transit_level <= 6;
CREATE INDEX planet_osm_polygon_transit_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_transit_level <= 9;
CREATE INDEX planet_osm_polygon_transit_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_transit_level <= 12;
CREATE INDEX planet_osm_polygon_transit_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_transit_level <= 15;
CREATE INDEX planet_osm_polygon_earth_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_earth_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_earth_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_earth_min_zoom <= 9;
CREATE INDEX planet_osm_polygon_earth_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_earth_min_zoom <= 12;
CREATE INDEX planet_osm_polygon_earth_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_earth_min_zoom <= 15;
CREATE INDEX planet_osm_polygon_water_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_water_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_water_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_water_min_zoom <= 9;
CREATE INDEX planet_osm_polygon_water_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_water_min_zoom <= 12;
CREATE INDEX planet_osm_polygon_water_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_water_min_zoom <= 15;
CREATE INDEX planet_osm_polygon_boundary_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_boundary_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_boundary_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_boundary_min_zoom <= 9;
CREATE INDEX planet_osm_polygon_boundary_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_boundary_min_zoom <= 12;
CREATE INDEX planet_osm_polygon_boundary_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_boundary_min_zoom <= 15;
CREATE INDEX planet_osm_polygon_building_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_building_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_building_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_building_min_zoom <= 15;
CREATE INDEX planet_osm_polygon_pois_geom_index ON planet_osm_polygon USING gist(way) WHERE mz_poi_min_zoom IS NOT NULL;
CREATE INDEX planet_osm_polygon_pois_geom_6_index ON planet_osm_polygon USING gist(way) WHERE mz_poi_min_zoom <= 6;
CREATE INDEX planet_osm_polygon_pois_geom_9_index ON planet_osm_polygon USING gist(way) WHERE mz_poi_min_zoom <= 9;
CREATE INDEX planet_osm_polygon_pois_geom_12_index ON planet_osm_polygon USING gist(way) WHERE mz_poi_min_zoom <= 12;
CREATE INDEX planet_osm_polygon_pois_geom_15_index ON planet_osm_polygon USING gist(way) WHERE mz_poi_min_zoom <= 15;
END $$;
ANALYZE planet_osm_polygon;