-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgen_bomen.py
101 lines (84 loc) · 2.96 KB
/
gen_bomen.py
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
#!/usr/bin/env python
from generate import block, header, p, q
species = [
"Iep (Ulmus)",
"Linde (Tilia)",
"Esdoorn (Acer)",
"Es (Fraxinus)",
"Plataan (Platanus)",
"Eik (Quercus)",
"Populier (Populus)",
"Els (Alnus)",
"Wilg (Salix)",
"Berk (Betula)",
"Kers (Prunus)",
"Haagbeuk (Carpinus)",
"Meidoorn (Crataegus)",
"Acacia (Robinia)",
"Paardenkastanje (Aesculus)",
"Vleugelnoot (Pterocarya)",
]
layers = [name for name in species] + ["Onbekende soorten", "Overige soorten"]
header("BOR")
with block("MAP"):
p("NAME", "bomen")
p("INCLUDE", "header.inc")
p("DEBUG", 5)
with block("WEB"):
with block("METADATA"):
q("ows_title", "Objecten openbare ruimte - bomen")
q(
"ows_abstract",
"Dataset met actuele informatie over de bomen in beheer van gemeente Amsterdam",
)
q("wms_extent", "100000 450000 150000 500000")
for name in layers:
shortname = name.split()[0].lower()
with block("LAYER"):
p("NAME", shortname)
p("GROUP", "bomen")
with block("PROJECTION"):
q("init=epsg:28992")
p("INCLUDE", "connection/dataservices.inc")
if name == "Onbekende soorten":
select_soort = "soortnaam_top = 'Onbekend' OR soortnaam_top IS NULL"
elif name == "Overige soorten":
select_soort = (
" AND ".join(f"soortnaam_top != '{s}'" for s in species)
+ " AND soortnaam_top IS NOT NULL"
)
else:
select_soort = f"soortnaam_top = '{name}'"
p(
"DATA",
"geometrie FROM ("
" SELECT id, geometrie, soortnaam_top FROM public.bomen_stamgegevens"
" WHERE type_soortnaam = 'Bomen'"
f" AND ({select_soort})"
") AS sub"
" USING srid=28992"
" USING UNIQUE id",
)
p("TYPE POINT")
with block("METADATA"):
q("wfs_enable_request", "!*")
q("wms_title", name)
q("wms_enable_request", "*")
q("wms_srs", "EPSG:28992")
q("wms_name", "Bomen")
q("wms_format", "image/png")
q("wms_server_version", "1.3.0")
q("wms_extent", "100000 450000 150000 500000")
p("LABELITEM", "soortnaam_top")
p("CLASSITEM", "soortnaam_top")
with block("CLASS"):
p("NAME", name)
p('MINSCALE', 3000)
with block("STYLE"):
p("SYMBOL", f"bomen_{shortname}")
p("SIZE", 16)
with block ("CLASS"):
p('MAXSCALE', 3000)
with block("STYLE"):
p("SYMBOL", f"bomen_{shortname}")
p("SIZE", 26)