From 7c233748b71a969caa98c69a1e9724dc5c56b12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Ch=C3=A2teau-Thierry?= Date: Wed, 13 Nov 2019 17:23:32 +0000 Subject: [PATCH] =?UTF-8?q?adresses=20sur=20voies=20non=20rapproch=C3=A9es?= =?UTF-8?q?=20(#45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 6 +++--- sql/numeros_hors_osm_par_fantoir.sql | 8 ++++---- sql/voies_adresses_non_rapprochees_insee.sql | 14 +++++++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) mode change 100755 => 100644 sql/numeros_hors_osm_par_fantoir.sql diff --git a/index.html b/index.html index 2a41f42..1dadcee 100644 --- a/index.html +++ b/index.html @@ -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) @@ -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]) } } @@ -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'; $('').appendTo($('#josm_target')).attr('src',srcURL); $(this).addClass('clicked'); }) diff --git a/sql/numeros_hors_osm_par_fantoir.sql b/sql/numeros_hors_osm_par_fantoir.sql old mode 100755 new mode 100644 index b26b5ef..59b3860 --- a/sql/numeros_hors_osm_par_fantoir.sql +++ b/sql/numeros_hors_osm_par_fantoir.sql @@ -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'; \ No newline at end of file diff --git a/sql/voies_adresses_non_rapprochees_insee.sql b/sql/voies_adresses_non_rapprochees_insee.sql index 422dc92..094896f 100644 --- a/sql/voies_adresses_non_rapprochees_insee.sql +++ b/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 @@ -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