Skip to content

Commit

Permalink
adresses sur voies non rapprochées (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdct committed Nov 13, 2019
1 parent 2ed5739 commit 7c23374
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions index.html
Expand Up @@ -451,7 +451,7 @@
$('#rub_places_non_match').empty().text(places_fantoir_non_match.length+" lieux-dits FANTOIR sans rapprochement OSM")
$('#rub_places_match').empty().text(places_fantoir_match.length+" lieux-dits FANTOIR avec rapprochement OSM")
$('.table_liste').empty()
add_header('table_adresses_non_match',true,false,false)
add_header('table_adresses_non_match',true,false,true)
add_header('table_adresses_match',true,false,true)
add_header('table_voies_fantoir_non_match',true,false,false)
add_header('table_voies_match',true,false,false)
Expand Down Expand Up @@ -503,7 +503,7 @@
}
//Statut Fantoir
add_statut_fantoir(data[l][5])
if (s==1 && data[l][6]){
if ((s==0|s==1) && data[l][6]){
add_josm_addr_link(table,$('#input_insee')[0].value,data[l][0],data[l][1],data[l][6])
}
}
Expand Down Expand Up @@ -607,7 +607,7 @@
.addClass('zone_click')
.text('Relation')
.click(function(){
srcURL = 'http://127.0.0.1:8111/import?new_layer=true&layer_name='+nom_fantoir+'&url='+window.location.href.split('fantoir')[0]+'fantoir/requete_numeros.py?insee='+insee+'&fantoir='+fantoir+'&modele=Relation';
srcURL = 'http://127.0.0.1:8111/import?new_layer=true&layer_name='+nom_fantoir+'&url='+window.location.href.split('#')[0]+'requete_numeros.py?insee='+insee+'&fantoir='+fantoir+'&modele=Relation';
$('<img>').appendTo($('#josm_target')).attr('src',srcURL);
$(this).addClass('clicked');
})
Expand Down
8 changes: 4 additions & 4 deletions sql/numeros_hors_osm_par_fantoir.sql 100755 → 100644
@@ -1,15 +1,15 @@
WITH
diff
AS
(SELECT numero,fantoir,voie_osm,insee_com FROM cumul_adresses WHERE insee_com = '__com__' AND fantoir = '__fantoir__' AND source = 'CADASTRE'
(SELECT numero,fantoir,insee_com FROM cumul_adresses WHERE insee_com = '__com__' AND fantoir = '__fantoir__' AND source = 'CADASTRE'
EXCEPT
SELECT numero,fantoir,voie_osm,insee_com FROM cumul_adresses WHERE insee_com = '__com__' AND fantoir = '__fantoir__' AND source = 'OSM')
SELECT numero,fantoir,insee_com FROM cumul_adresses WHERE insee_com = '__com__' AND fantoir = '__fantoir__' AND source = 'OSM')
SELECT ST_X(c.geometrie),
ST_Y(c.geometrie),
diff.numero,
diff.fantoir,
diff.voie_osm
COALESCE(c.voie_osm,c.voie_cadastre)
FROM cumul_adresses c
JOIN diff
USING (numero,fantoir,voie_osm,insee_com)
USING (numero,fantoir,insee_com)
WHERE source = 'CADASTRE';
14 changes: 13 additions & 1 deletion sql/voies_adresses_non_rapprochees_insee.sql
@@ -1,9 +1,19 @@
WITH
diff_numero_fantoir
AS
(SELECT numero,fantoir FROM cumul_adresses WHERE insee_com = '__com__' and source = 'CADASTRE'
EXCEPT
SELECT numero,fantoir FROM cumul_adresses WHERE insee_com = '__com__' and source = 'OSM'),
fantoir_numeros_manquants
AS
(SELECT DISTINCT fantoir,count(*) AS a_proposer FROM diff_numero_fantoir GROUP BY 1)
SELECT f.code_insee||f.id_voie||f.cle_rivoli fantoir,
nature_voie||' '||libelle_voie voie,
'--',
st_x(g.geometrie),
st_y(g.geometrie),
COALESCE(s.id_statut,0)
COALESCE(s.id_statut,0),
COALESCE(fm.a_proposer,0)
FROM fantoir_voie f
JOIN (SELECT fantoir
FROM cumul_adresses
Expand All @@ -22,6 +32,8 @@ JOIN (SELECT DISTINCT fantoir,
WHERE insee_com = '__com__' AND
source = 'CADASTRE') g
ON g.fantoir = j.fantoir
LEFT OUTER JOIN fantoir_numeros_manquants fm
ON f.code_insee||f.id_voie||f.cle_rivoli = fm.fantoir
LEFT OUTER JOIN (SELECT fantoir,id_statut
FROM (SELECT *,rank() OVER (PARTITION BY fantoir ORDER BY timestamp_statut DESC) rang
FROM statut_fantoir
Expand Down

0 comments on commit 7c23374

Please sign in to comment.