forked from osm-fr/osm-vs-fantoir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
voies_recentes_manquantes.html
299 lines (296 loc) · 7.97 KB
/
voies_recentes_manquantes.html
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<html>
<head>
<meta charset="UTF-8">
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
<link rel="stylesheet" href="css/tablesorter.css" type="text/css"/>
<style>
body{
font-family: monospace;
}
#bandeau{
top:0px;
width:100%;
height:70px;
z-index:3;
position:fixed;
background-color:white;
}
#reponse{
position:absolute;
top:80px;
z-index:2;
}
#credits{
background:darkgrey;
position:fixed;
bottom:0px;
width:100%;
overflow:visible;
z-index:4;
text-align: justify;
}
#pied_de_page{
position:relative;
width:100%;
height:30px;
z-index:3;
}
/* .cellule_intitule{
text-align: right;
}
.cellule_data{
font-weight: bold;
}
#rubriques{
position:absolute;
top:130px;
}
#rubriques th{
background-color:black;
color:white;
}
.emphase{
color:red;
font-size: x-large;
}
.rubrique{
cursor:pointer;
width:200px;
height:50px;
position:relative;
color:black;
font-weight: bold;
background:white;
margin-right:10px;
}
.rubrique.active{
border:3px solid black;
}
.table_liste{
display:none;
}
*/ .zone_click{
cursor:pointer;
color:blue;
text-decoration: underline;
}
.zone_click.clicked{
background-color:green;
color:white;
}
#wait_ajax{
position:fixed;
z-index:1;
width:100%;
height:100%;
background-color:lightgray;
opacity:0;
text-align:center;
}
#wait_ajax span{
background-color:black;
vertical-align:middle;
font-size:30px;
line-height:500px;
color:white;
border:50px solid black;
}
/* #infobulle_aide{
position: fixed;
color: red;
background: #dddddd;
width: 40px;
height: 40px;
border-radius: 40px;
top: 10px;
right: 10px;
vertical-align: bottom;
text-align: center;
font-weight: bolder;
font-size: 35px;
}
#aide{
position:fixed;
top:5px;
right:5px;
width:400px;
height:100%;
background-color:lavender;
overflow-y:scroll;
visibility:hidden;
z-index: 10;
}
*/ #table_voies_recentes tr td{
background:white;
color:black;
font-weight: normal;
}
table.tablesorter thead tr .header {
height:40px;
}
</style>
<script>
var menu_labels
var commune_valide = false
var osm_state
var titre = "Voies récentes inconnues d'OSM"
function is_valid_dept(d){
pattern_dept = new RegExp('^([01]|[3-8])([0-9])$|^2([aAbB]|[1-9])$|^9([0-5]|7[1-4]|76)$')
res = false
if (pattern_dept.test(d)){
res = d
}
return res
}
function check_url_for_dept(){
var res
if (window.location.hash){
if (window.location.hash.split('dept=')[1]){
if (is_valid_dept(window.location.hash.split('dept=')[1].split('&')[0])){
res = window.location.hash.split('dept=')[1].split('&')[0]
} else {
// document.title = titre
alert(window.location.hash.split('dept=')[1].split('&')[0]+' n\'est pas un numero de département valide\n\nAbandon')
}
}
}
return res
}
function check_form_for_dept(){
res = false
if (is_valid_dept($('#input_dept')[0].value)){
res = $('#input_dept')[0].value
} else {
alert($('#input_dept')[0].value+' n\'est pas un numero de département valide\n\nAbandon')
}
return res
}
function start(){
document.title = titre
dept = check_url_for_dept()
if (dept){
$('#input_dept').empty()
$('#input_dept')[0].value = dept
requete_voies_dept();
}
}
function requete_voies_dept(){
if (check_form_for_dept()){
dept = $('#input_dept')[0].value
document.title = titre+' ('+dept+')'
$('body').css('cursor','progress');
$('#wait_ajax').empty()
.css('z-index','20')
.css('opacity','0.8')
.append($('<span>').append('Recherche des voies récentes...'));
$.ajax({
url: "voies_recentes_manquantes_dept.py?dept="+dept,
})
.done(function( data ){
$('body').css('cursor','default');
$('#table_voies_recentes').empty()
url_map_org_part1 = 'http://www.openstreetmap.org/'
url_map_fr_part1 = 'http://tile.openstreetmap.fr/'
url_bano_part1 = 'http://tile.openstreetmap.fr/~cquest/leaflet/bano.html'
url_edit_part1 = 'http://www.openstreetmap.org/edit?editor='
delta = 0.0008
add_header('table_voies_recentes',true)
$('#table_voies_recentes').append($('<tbody>'))
table = 'table_voies_recentes'
for (l=0;l<data.length;l++){
insee = (data[l][1])
//Dept
$('#'+table).append($('<tr>').attr('id',data[l][4]).append($('<td>').text(data[l][0])))
//Commune (INSEE)
$('#'+table+' tr:last').append($('<td>').text(data[l][2]+'('+data[l][1]+')'))
//Fantoir
$('#'+table+' tr:last').append($('<td>').text(data[l][4]))
//Voie
$('#'+table+' tr:last').append($('<td>').text(data[l][3]))
//Date de création
$('#'+table+' tr:last').append($('<td>').text(data[l][7]))
lon = data[l][5]
lat = data[l][6]
if (lon && lat){
url_ol_part2 = '?zoom=18&lat='+lat+'&lon='+lon
url_hash_coords = '18/'+lat+'/'+lon
xleft = lon-delta
xright = lon+delta
ybottom = lat-delta
ytop = lat+delta
//visu
add_map_link(table,url_map_org_part1+'#map='+url_hash_coords,'ORG')
add_map_link(table,url_map_fr_part1+url_ol_part2,'FR')
add_map_link(table,url_bano_part1+'#'+url_hash_coords,'BANO')
//JOSM
add_josm_link(table,xleft,xright,ybottom,ytop)
//ID
add_map_link(table,url_edit_part1+'id#map='+url_hash_coords,'ID')
//Potlatch
add_map_link(table,url_edit_part1+'potlatch2#map='+url_hash_coords,'P2')
//Fantoir
add_map_link(table,'./index.html#insee='+insee,'Fantoir-OSM '+insee)
add_map_link(table,'./liste_brute_fantoir.html#insee='+insee,'Fantoir brut '+insee)
}
}
$('#wait_ajax').css('z-index','1').css('opacity','0');
$('#table_voies_recentes').tablesorter();
})
window.location.hash="#dept="+$('#input_dept')[0].value
};
}
function add_map_link(table,href,text){
$('#'+table+' tr:last').append($('<td>')
.append($('<a>')
.attr('href',href)
.attr('target','blank')
.text(text)))
}
function add_josm_link(table,xl,xr,yb,yt){
$('#'+table+' tr:last').append($('<td>')
.addClass('zone_click')
.attr('xleft',xl).attr('xright',xr).attr('ybottom',yb).attr('ytop',yt)
.text('JOSM')
.click(function(){
srcLoadAndZoom = 'http://127.0.0.1:8111/load_and_zoom?left='+xl+'&right='+xr+'&top='+yt+'&bottom='+yb;
$('<img>').appendTo($('#josm_target')).attr('src',srcLoadAndZoom);
$(this).addClass('clicked');
})
)
}
function add_header(table,with_edit_and_map_links){
$('#'+table).empty().append($('<thead>').append($('<tr>').append($('<th>').append('Dept'))))
$('#'+table+' tr').append($('<th>').append('Commune(INSEE)'))
$('#'+table+' tr').append($('<th>').append('Fantoir'))
$('#'+table+' tr').append($('<th>').append('Voie'))
$('#'+table+' tr').append($('<th>').append('Date de création'))
if (with_edit_and_map_links){
$('#'+table+' tr').append($('<th>').attr('colspan','3').append('Cartes'))
$('#'+table+' tr').append($('<th>').attr('colspan','3').append('Édition'))
$('#'+table+' tr').append($('<th>').attr('colspan','2').append('FANTOIR'))
}
}
</script>
</head>
<body onload="start()">
<div id="bandeau">
<form action="javascript:requete_voies_dept()" autocomplete="on">
<input type="text" id="input_dept" placeholder="N° de département"></input>
<input type="submit" value="Afficher">
</form>
<h2>Voies récentes selon FANTOIR, connues du Cadastre mais pas d'OSM</h2>
<!--div id="pied_de_page"></div-->
</div>
<div id="reponse">
<table id="table_voies_recentes" class="tablesorter"></table>
<div id="pied_de_page"></div>
</div>
<div id="credits">
Données OpenStreetMap : © les Contributeurs d'OpenStreetMap <a href="http://opendatacommons.org/licenses/odbl/">Licence ODbL</a>
- Données FANTOIR : © 2015 Ministère de l'Économie et des Finances (DGFiP) - <a href="http://wiki.data.gouv.fr/wiki/Licence_Ouverte_/_Open_Licence">Licence LO/OL</a>
</div>
<div id="josm_target" style="visibility : hidden"></div>
<div id="wait_ajax"></div>
</body>
</html>