-
Notifications
You must be signed in to change notification settings - Fork 2
/
project.yml
267 lines (249 loc) · 7.63 KB
/
project.yml
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
bounds: &world
- -180
- -85.05112877980659
- 180
- 85.05112877980659
center:
- 3.4018
- 47.8511
- 18
format: png8
interactivity: false
minzoom: 6
maxzoom: 20
scale: 1
metatile: 8
name: bano-cartocss
description: ''
attribution: ''
# Various parts to be included later on
_parts:
extents: &extents
extent: *world
srs-name: "3857"
srs: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
extents84: &extents84
extent: *world
srs-name: "WGS84"
srs: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
banodb: &banodb
type: "postgis"
dbname: "cadastre"
host: "banodb"
user: "renderd"
password: "m4d31nfr4nc3"
extent: "-180,-85,180,85"
srid: 4326
asynchronous_request: 'true'
max_async_connection: 4
max_size: 24
connect_timeout: 10
bdtopo: &bdtopo
type: "postgis"
dbname: "osm"
host: "localhost"
user: "fr"
password: "m4d31nfr4nc3"
extent: "-180,-85,180,85"
srid: 4326
asynchronous_request: 'true'
max_async_connection: 4
max_size: 24
connect_timeout: 10
Stylesheet:
- style.mss
Layer:
# points d'adresses BAN
- id: ban
name: ban
status: off
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT b.geometrie,
b.nom_voie,
b.numero::numeric as numero,
trim(b.numero||' '||coalesce(b.rep,'')) as num,
coalesce(v.fantoir,'') as fantoir
FROM ban_odbl b
LEFT JOIN cumul_voies v ON (v.insee_com=b.code_insee
AND v.fantoir LIKE
b.code_insee||SUBSTRING(UPPER(b.id_fantoir)||'xxxxxxxxxx',7,4)||'%')
) as ban
geometry_field: geometrie
- id: addr
name: addr
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT
geometrie,
left(source,3) as source,
numero,
SUBSTRING(COALESCE(voie_osm,''),1,1) AS voie_o,
SUBSTRING(fantoir,1,1) as fant
FROM cumul_adresses
WHERE source != 'CADASTRE'
AND (substring(fantoir,6,1)<='9' OR voie_osm != '')
ORDER BY voie_o desc, source
) as addr
geometry_field: geometrie
- id: addr_lz
name: addr_lz
status: off
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT
co.geometrie,
co.insee_com AS insee,
nom_com,
format_cadastre,
sum(case when source='OSM' then 1 else 0 end) as osm,
sum(case when source='BAN' then 1 else 0 end) as cadastre,
100*(sum(case when source='OSM' then 1 else 0 end)+1)/(sum(case when source='BAN' then 1
else 0 end)+1) as pourcent
FROM infos_communes co
LEFT JOIN code_cadastre ca on (ca.insee_com = co.insee_com)
LEFT JOIN cumul_adresses cu on (cu.insee_com=co.insee_com)
GROUP BY co.insee_com, ca.nom_com, co.geometrie, format_cadastre
) as addr_lz
geometry_field: geometrie
- id: voie_nommee
<<: *extents84
Datasource:
<<: *bdtopo
table: >-
(
SELECT
r.geometrie,
regexp_replace(regexp_replace(regexp_replace(initcap(nom_minuscule),E' L(e |a |es |\x27)',' l\1','g'),E' D(e |u |es |\x27)',' d\1','g'),' A(|u|ux) ',' a\1 ','g') as nom,
r.qualite_passage_maj_min as qualite,
r.id_pseudo_fpb
FROM
bdtopo_voie_nommee r
WHERE
r.validite
) as troncon_de_route
- id: manque_ban
name: manque_ban
status: off
<<: *extents84
Datasource:
<<: *banodb
table: >-
(SELECT
st_buffer(st_convexhull(st_collect(b.geometrie)), 20 * !pixel_width!) as geom,
b.nom_voie,
coalesce(b.code_insee||SUBSTRING(UPPER(b.id_fantoir)||'xxxxxxxxxx',7,4)||f.cle_rivoli,'') as fant_voie,
b.code_insee,
count(*) as nb
FROM polygones_insee_geo c
JOIN ban_odbl b on (b.geometrie && c.geometrie and b.code_insee=c.insee_com)
LEFT JOIN cumul_voies v on (
v.insee_com=b.code_insee and
(v.fantoir LIKE b.code_insee||SUBSTRING(UPPER(b.id_fantoir)||'xxxxxxxxxx',7,4)||'%'
OR
v.voie_osm::text <-> b.nom_voie = 1))
LEFT JOIN fantoir_voie f on (f.code_insee = b.code_insee
AND f.fantoir = b.code_insee||SUBSTRING(UPPER(b.id_fantoir)||'xxxxxxxxxx',7,4))
WHERE
b.numero!='0'
AND b.nom_voie!=''
AND v.fantoir is null
AND c.geometrie && !bbox!
GROUP BY 2,3,4
) as manque_ban
geometry_field: geom
- id: manque
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT st_buffer(st_convexhull(st_collect(cu.geometrie)), 20 * !pixel_width!) as geometrie,
cu.fantoir,
cu.voie_autre as voie_ban,
coalesce(cu.voie_osm,'') as voie_osm,
count(*) as nb,
replace(coalesce(b.source_nom_voie,cu.source),'inconnue','BAN') as source,
l.label_statut
FROM polygones_insee_geo co
JOIN cumul_adresses cu on (cu.insee_com=co.insee_com
and ((coalesce(cu.voie_osm,'')=''
and cu.source='BAN')
or (cu.fantoir=''
and cu.source='OSM')))
JOIN fantoir_voie f on (f.fantoir10=cu.fantoir and f.date_annul='0000000')
LEFT JOIN statut_fantoir s on (s.fantoir=cu.fantoir)
LEFT JOIN labels_statuts_fantoir l on (l.id_statut=s.id_statut)
LEFT JOIN ban_odbl b ON (b.code_insee=left(fantoir10,5) and id like format('%s_%s%%',left(fantoir10,5),substring(fantoir10,6,4)))
WHERE co.geometrie && !bbox!
AND substring(cu.fantoir,6,1) <= '9'
GROUP BY cu.fantoir, cu.voie_autre, cu.voie_osm, cu.source, l.label_statut, b.source_nom_voie
) as manque
geometry_field: geometrie
- id: voies
name: voies
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT v.*
FROM cumul_voies v
LEFT JOIN cumul_adresses a on (a.fantoir=v.fantoir) where a.fantoir is null
) as voies
geometry_field: geometrie
- id: fantoir
name: fantoir
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT geometrie,
name as nom,
insee_com as insee,
count(*) as nb,
format_cadastre,
min(fantoir) as min_fantoir
FROM (
SELECT co.geometrie,
name,
co.insee_com,
format_cadastre,
fantoir
FROM infos_communes co
LEFT JOIN cumul_adresses cu on (cu.insee_com=co.insee_com and source='BAN' and (coalesce(voie_osm,'')=''))
LEFT JOIN code_cadastre ca on (ca.insee_com=co.insee_com)
WHERE co.geometrie && !bbox!
AND substring(cu.fantoir,6,1) <= '9'
GROUP BY co.geometrie, name, co.insee_com, format_cadastre, fantoir
) as fantoir
GROUP BY geometrie, nom, insee, format_cadastre
) as f
geometry_field: geometrie
- id: lieuxdits
name: lieuxdits
<<: *extents84
Datasource:
<<: *banodb
table: >-
(
SELECT geometrie,
libelle_cadastre,
coalesce(libelle_osm,'') as libelle_osm,
fantoir,
ld_bati,
source
FROM cumul_places
ORDER BY source
) as place
geometry_field: geometrie