forked from osm-fr/osmose-fr-opendata-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzer-qa-missing-highways.sh
executable file
·55 lines (46 loc) · 2.29 KB
/
analyzer-qa-missing-highways.sh
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
. $(dirname $0)/config.sh
OUT=/home/cquest/public_html/insee_routes-france.xml
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<analysers timestamp=\"`date -u +%Y-%m-%dT%H:%M:%SZ`\">
<analyser timestamp=\"`date -u +%Y-%m-%dT%H:%M:%SZ`\">
<class item=\"7170\" tag=\"highway\" id=\"1\" level=\"2\">
<classtext lang=\"fr\" title=\"route potentiellement manquante à proximité\" />
<classtext lang=\"en\" title=\"possibly missing highway in the area\" />
</class>
" > $OUT
psql osm -c "
select format('<error class=\"1\" subclass=\"1\"><location lat=\"%s\" lon=\"%s\" /><text lang=\"en\" value=\"%s hab. carreau %s\" /><text lang=\"en\" value=\"square id %s (pop. %s)\" /></error>',
round(st_y(st_centroid(st_transform(wkb_geometry,4326)))::numeric,6),
round(st_x(st_centroid(st_transform(wkb_geometry,4326)))::numeric,6),
ceiling(m.ind_c), m.id,
m.id, ceiling(m.ind_c))
from insee_menages m
where highways = 0 AND ceiling(m.ind_c)>5
order by hash;
" -t >> $OUT
echo "
</analyser>
</analysers>" >> $OUT
curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT http://osmose.openstreetmap.fr/control/send-update
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<analysers timestamp=\"`date -u +%Y-%m-%dT%H:%M:%SZ`\">
<analyser timestamp=\"`date -u +%Y-%m-%dT%H:%M:%SZ`\">
<class item=\"7170\" tag=\"highway\" id=\"10\" level=\"3\">
<classtext lang=\"fr\" title=\"route potentiellement manquante à proximité\" />
<classtext lang=\"en\" title=\"possibly missing highway in the area\" />
</class>
" > $OUT
psql osm -c "
select format('<error class=\"10\" subclass=\"1\"><location lat=\"%s\" lon=\"%s\" /><text lang=\"en\" value=\"%s hab. carreau %s\" /><text lang=\"en\" value=\"square id %s (pop. %s)\" /></error>',
round(st_y(st_centroid(st_transform(wkb_geometry,4326)))::numeric,6),
round(st_x(st_centroid(st_transform(wkb_geometry,4326)))::numeric,6),
ceiling(m.ind_c), m.id,
m.id, ceiling(m.ind_c))
from insee_menages m
where highways = 0 AND ceiling(m.ind_c)<=5
order by hash;
" -t >> $OUT
echo "
</analyser>
</analysers>" >> $OUT
curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT http://osmose.openstreetmap.fr/control/send-update