<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://prev.openstreetmap.fr"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>OpenStreetMap France - qualité</title>
 <link>http://prev.openstreetmap.fr/tags/qualit</link>
 <description>  </description>
 <language>fr</language>
<item>
 <title>Osmose, l&#039;outil de qualité d&#039;OSM-FR évolue !</title>
 <link>http://prev.openstreetmap.fr/osmose-evolutions-septembre-2014</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt; &lt;p&gt;La plus grosse avancée sur cette période est la couverture de nouveaux de pays :&lt;br /&gt;- Support de toute l&#039;Afrique&lt;br /&gt;- Europe : un certain nombre de pays de petits pays Açores, Albanie, Bosnie-Herzégovine, Bulgarie, Chypre, Croatie, Estonie, Hongrie, Île de Man, Kosovo, Lettonie, Liechtenstein, Lituanie, Macédoine, Malte, Monténégro, Moldavie, Roumanie, Serbie et Slovénie.&lt;br /&gt;- Europe : un nouveau serveur aux Pays-Bas pour le calcul sur le pays effectué par régions.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 04 Sep 2014 15:16:25 +0000</pubDate>
 <dc:creator>webmaster</dc:creator>
 <guid isPermaLink="false">18603 at http://prev.openstreetmap.fr</guid>
 <comments>http://prev.openstreetmap.fr/osmose-evolutions-septembre-2014#comments</comments>
</item>
<item>
 <title>Quality control on french OSM administrative boundaries</title>
 <link>http://prev.openstreetmap.fr/node/18532</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt; &lt;div id=&quot;magicdomid2&quot;&gt;Tracing France administrative boundaries is a tedious work that took several yers as France has 36000+ municipalities which is around 40% of all Europe municipalities !&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;In 2011, then in 2013, IGN (french geographic national authority) published 2 datasets in opendata, GEOFLA and Route500, but these data are simplified with a much lower level of details compared to &lt;a class=&quot;lexicon-term&quot; href=&quot;http://prev.openstreetmap.fr/glossaire/osm&quot;&gt;&lt;dfn title=&quot;Acronyme utilisé pour &amp;quot;OpenStreetMap&amp;quot;.&quot;&gt;OSM&lt;/dfn&gt;&lt;/a&gt; goals.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;div style=&quot;font-size: 12px;&quot;&gt;So, the only authorized and good enough source for that job is the french cadastre.&lt;/div&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;As we&#039;re getting close to 100% completeness of french administrative boundaries, it is time to study their quality. Without freely available reference data, an exhaustive study is not possible, but let&#039;s try with what we have.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;GEOFLA and Route500 contain simplified administrative boundaries, but it seems that the crossing nodes have been more or less maintained very close to their original location.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;So I&#039;ve tried to do some comparison on these crossing nodes between OSM and Route500 (less simplified that GEOFLA).&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;em&gt;(if PostGIS SQL queries are not your favorite reading, &lt;a href=&quot;#fin&quot;&gt;you can skip to the end of this post&lt;/a&gt;)&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid52&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid6&quot;&gt;&lt;strong&gt;Import Route500 in PostGIS...&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid25&quot;&gt;&lt;em&gt;export SHAPE_ENCODING=&quot;ISO-8859-1&quot;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid26&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm LIMITE_ADMINISTRATIVE.SHP -overwrite -nlt GEOMETRY -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid752&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm NOEUD_COMMUNE.SHP -overwrite -nlt GEOMETRY  -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid755&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm COMMUNE.SHP -overwrite -nlt GEOMETRY  -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid28&quot;&gt; &lt;/div&gt;&lt;div&gt;Geometries a reprojected in mercator as for the OSM data we will use an osm2pgsql schema usually used to generate tiles.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;We then to some cleaning and add some usefull indexes...&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid30&quot;&gt;&lt;em&gt;ALTER TABLE NOEUD_COMMUNE RENAME TO r500_communes_noeuds;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid31&quot;&gt;&lt;em&gt;ALTER TABLE r500_communes_noeuds drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid32&quot;&gt;&lt;em&gt;ALTER TABLE LIMITE_ADMINISTRATIVE RENAME TO r500_limite_admin;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid756&quot;&gt;&lt;em&gt;ALTER TABLE r500_limite_admin drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid763&quot;&gt;&lt;em&gt;ALTER TABLE LIMITE_ADMINISTRATIVE RENAME TO r500_communes;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid764&quot;&gt;&lt;em&gt;ALTER TABLE r500_communes drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid36&quot;&gt;&lt;em&gt;CREATE TABLE r500_noeuds (pt geometry, nb integer, insee text);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid677&quot;&gt;&lt;em&gt;CREATE INDEX on r500_noeuds  using gist(pt);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid684&quot;&gt;&lt;em&gt;CREATE INDEX on r500_noeuds (insee);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid38&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid691&quot;&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;Then we extract the crossing nodes...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;INSERT INTO r500_noeuds select ST_Line_Interpolate_Point(l.wkb_geometry,0) as pt, null, null from r500_limite_admin l;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid804&quot;&gt;&lt;em&gt;INSERT INTO r500_noeuds select ST_Line_Interpolate_Point(l.wkb_geometry,1) as pt, null, null from r500_limite_admin l;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid1066&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid805&quot;&gt;and determine which municipalities are sharing them...&lt;/div&gt;&lt;div id=&quot;magicdomid821&quot;&gt;&lt;em&gt;INSERT INTO r500_noeuds select pt, count(distinct(insee_comm)), string_agg(distinct(insee_comm),&#039; &#039; order by insee_comm) as insee from r500_noeuds join r500_communes c on (st_touches(pt,wkb_geometry)) join r500_communes_noeuds n on (n.id_rte500=c.id_rte500) group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid1063&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid830&quot;&gt;and a final cleanup:&lt;/div&gt;&lt;div id=&quot;magicdomid841&quot;&gt;&lt;em&gt;DELETE FROM r500_noeuds where nb is null;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid846&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1060&quot;&gt;The resulting table contains 72598 nodes (Route500 2012) with:&lt;/div&gt;&lt;div id=&quot;magicdomid43&quot;&gt;&lt;ul&gt;&lt;li&gt;crossing node&lt;/li&gt;&lt;li&gt;number of municipalities sharing that node: 1 for islands, enclaves and exclaves, 2 for municipalities on the seaside or at international border, 3 or more in most cases&lt;/li&gt;&lt;li&gt;INSEE unique codes identifying the municipalities sharing the node (in ascending order)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid46&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid259&quot;&gt;&lt;strong&gt;OSM crossing nodes&lt;/strong&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid354&quot;&gt; &lt;/div&gt;&lt;div&gt;Same structure for the table:&lt;/div&gt;&lt;div id=&quot;magicdomid355&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid251&quot;&gt;&lt;em&gt;CREATE TABLE osm_noeuds (pt geometry, nb integer, insee text);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid681&quot;&gt;&lt;em&gt;CREATE INDEX on osm_noeuds  using gist(pt);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid683&quot;&gt;&lt;em&gt;CREATE INDEX on osm_noeuds (insee);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid479&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid425&quot;&gt;To speedup processing, a temporary table only containing municipalities polygons is created:&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid469&quot;&gt;&lt;em&gt;CREATE TEMP TABLE osm_communes as (select &quot;ref:INSEE&quot; as insee, way FROM planet_osm_polygon WHERE boundary is not null and boundary=&#039;administrative&#039; and admin_level=&#039;8&#039; and &quot;ref:INSEE&quot; is not null);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid466&quot;&gt;&lt;em&gt;CREATE INDEX on osm_communes using gist(way);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid483&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid517&quot;&gt;Then crossing nodes are extracted (with this poorly optimized query)...&lt;/div&gt;&lt;div id=&quot;magicdomid519&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid523&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, null, null from (select  st_line_interpolate_point((st_dump(st_linemerge(st_intersection(c.way,l.way)))).geom,0) as pt  from osm_communes l join osm_communes c on (st_touches(c.way,l.way) and c.insee &amp;gt; l.insee)) as lim group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid524&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, null, null from (select st_line_interpolate_point((st_dump(st_linemerge(st_intersection(c.way,l.way)))).geom,1) as pt  from osm_communes l join osm_communes c on (st_touches(c.way,l.way) and c.insee &amp;gt; l.insee)) as lim group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid550&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid562&quot;&gt;Remove the doubles...&lt;/div&gt;&lt;div id=&quot;magicdomid564&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid568&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, 0,null from osm_noeuds group by pt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;DELETE FROM osm_noeuds where nb is null;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid584&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid622&quot;&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;and determine which municipalities are sharing them&lt;/span&gt;:&lt;/div&gt;&lt;div id=&quot;magicdomid624&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid673&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, count(*), string_agg(c.insee,&#039; &#039; order by c.insee) as insee from osm_noeuds join osm_communes c on (st_touches(pt,way)) group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid675&quot;&gt;&lt;em&gt;DELETE FROM osm_noeuds where nb=0;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid634&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid917&quot;&gt;Tables r500_noeuds and osm_noeuds are similar, we can start comparing their content... and get the 100 largest differences :&lt;/div&gt;&lt;div id=&quot;magicdomid891&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid925&quot;&gt;&lt;em&gt;SELECT &lt;/em&gt;&lt;em style=&quot;background-color: #e8e8e8; font-size: 12px;&quot;&gt;min(st_distance(st_transform(r.pt,2154),st_transform(o.pt,2154))) as d , &lt;/em&gt;&lt;em style=&quot;font-size: 12px;&quot;&gt;r.insee from r500_noeuds r join osm_noeuds o on (r.insee=o.insee) group by r.insee order by d desc limit 100;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid928&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1044&quot;&gt;&lt;strong&gt;&lt;a name=&quot;fin&quot; id=&quot;fin&quot;&gt;&lt;/a&gt;Résults&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid969&quot;&gt;A CSV file containing the above query result is updated every night at:&lt;span style=&quot;font-size: 12px;&quot;&gt; &lt;/span&gt;&lt;a style=&quot;background-color: transparent;&quot; title=&quot;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&quot; href=&quot;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&quot;&gt;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&lt;/a&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid971&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1029&quot;&gt;It contains :&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;the distance between OSM and Route500 crossing nodes, which median value is &lt;span style=&quot;text-decoration: underline;&quot;&gt;22m&lt;/span&gt; (half of differences are below 22m)&lt;/li&gt;&lt;li&gt;INSEE codes of the municipalities (space separated)&lt;/li&gt;&lt;/ul&gt;These raw data are available for further analysis, and also to check/fix OSM data where needed.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Here is a data visualisation of these differences, provided thru a new overlay on&lt;a style=&quot;background-color: transparent;&quot; href=&quot;http://tile.openstreetmap.fr/?zoom=7&amp;amp;lat=47.19063&amp;amp;lon=3.25498&amp;amp;layers=B0000000FFFTF&quot;&gt; tile.openstreetmap.fr&lt;/a&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://tile.openstreetmap.fr/?zoom=7&amp;amp;lat=47.19063&amp;amp;lon=3.25498&amp;amp;layers=B0000000FFFTF&quot;&gt;&lt;img style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; src=&quot;/f/img/2013-11/openfla-route500_0.jpg&quot; alt=&quot;&quot; width=&quot;600&quot; height=&quot;577&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;More reading (in french) about this overlay is available on OSM wiki : &lt;a href=&quot;http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr#Couche_.22Limites_administratives_FR.22&quot;&gt;http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr#Couc...&lt;/a&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/tags/qualit&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;qualité&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;translation_fr first last&quot;&gt;&lt;a href=&quot;/blogs/cquest/controle-qualite-limites-administratives-osm&quot; title=&quot;Contrôle qualité des limites administratives françaises dans OSM&quot; class=&quot;translation-link&quot;&gt;Français&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
 <pubDate>Thu, 21 Nov 2013 10:41:25 +0000</pubDate>
 <dc:creator>cquest</dc:creator>
 <guid isPermaLink="false">18532 at http://prev.openstreetmap.fr</guid>
 <comments>http://prev.openstreetmap.fr/node/18532#comments</comments>
</item>
<item>
 <title>Contrôle qualité des limites administratives françaises dans OSM</title>
 <link>http://prev.openstreetmap.fr/blogs/cquest/controle-qualite-limites-administratives-osm</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt; &lt;div id=&quot;magicdomid2&quot;&gt;Le tracé des limites administratives communales françaises est un travail de fourmis que les contributeurs &lt;a class=&quot;lexicon-term&quot; href=&quot;http://prev.openstreetmap.fr/glossaire/osm&quot;&gt;&lt;dfn title=&quot;Acronyme utilisé pour &amp;quot;OpenStreetMap&amp;quot;.&quot;&gt;OSM&lt;/dfn&gt;&lt;/a&gt; ont démarré il y a déjà plusieurs années.&lt;/div&gt;&lt;div&gt;La seule source de qualité pour laquelle nous avons une autorisation d&#039;utilisation est le cadastre.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;En 2011 puis en 2013, l&#039;IGN a bien libéré le GEOFLA™®© puis le Route500™®©, mais ces données sont simplifiées et d&#039;une qualité très inférieure à l&#039;objectif que se sont fixé les fourmis mappeuses.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Les 100% étant bientôt atteints, se pose la question de la qualité de ces données et leur vérification. En l&#039;absence d&#039;accès aux données &quot;de référence&quot;, il n&#039;est pas possible de faire une étude exhaustive, mais a minima une étude sur des points vérifiables.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Le GEOFLA et le Route500 contiennent donc des limites simplifiées, mais cette simplification semble n&#039;avoir était faite que sur les polylignes et pas (ou peu) sur les nœuds d&#039;intersection où les frontières de plusieurs communes se rejoignent.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;J&#039;ai donc creusé cette idée &quot;pour voir&quot; et voici comment j&#039;ai procédé pour comparer ces nœuds dans OSM et Route500.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;em&gt;(si les requêtes SQL ne sont pas votre lecture favorite, &lt;a href=&quot;#fin&quot;&gt;vous pouvez zapper à la fin de ce billet&lt;/a&gt;)&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid52&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid6&quot;&gt;&lt;strong&gt;Tout d&#039;abord l&#039;import du Route500 dans une base PostGIS...&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid25&quot;&gt;&lt;em&gt;export SHAPE_ENCODING=&quot;ISO-8859-1&quot;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid26&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm LIMITE_ADMINISTRATIVE.SHP -overwrite -nlt GEOMETRY -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid752&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm NOEUD_COMMUNE.SHP -overwrite -nlt GEOMETRY  -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid755&quot;&gt;&lt;em&gt;ogr2ogr -t_srs EPSG:900913 -f PostgreSQL PG:dbname=osm COMMUNE.SHP -overwrite -nlt GEOMETRY  -lco SCHEMA=public&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid28&quot;&gt; &lt;/div&gt;&lt;div&gt;Les géométries sont reprojetées en mercator car c&#039;est une base osm2pgsql destinée à la production de tuiles qui va être utilisée côté OSM.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Dans psql on procède à un peu de nettoyage et à la création de quelques index qui seront bien utiles... &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid30&quot;&gt;&lt;em&gt;ALTER TABLE NOEUD_COMMUNE RENAME TO r500_communes_noeuds;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid31&quot;&gt;&lt;em&gt;ALTER TABLE r500_communes_noeuds drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid32&quot;&gt;&lt;em&gt;ALTER TABLE LIMITE_ADMINISTRATIVE RENAME TO r500_limite_admin;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid756&quot;&gt;&lt;em&gt;ALTER TABLE r500_limite_admin drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid763&quot;&gt;&lt;em&gt;ALTER TABLE LIMITE_ADMINISTRATIVE RENAME TO r500_communes;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid764&quot;&gt;&lt;em&gt;ALTER TABLE r500_communes drop ogc_fid;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid36&quot;&gt;&lt;em&gt;CREATE TABLE r500_noeuds (pt geometry, nb integer, insee text);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid677&quot;&gt;&lt;em&gt;CREATE INDEX on r500_noeuds  using gist(pt);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid684&quot;&gt;&lt;em&gt;CREATE INDEX on r500_noeuds (insee);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid38&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid691&quot;&gt;Ensuite il faut extraire ces nœuds d&#039;intersection...&lt;/div&gt;&lt;div&gt;&lt;em&gt;INSERT INTO r500_noeuds select ST_Line_Interpolate_Point(l.wkb_geometry,0) as pt, null, null from r500_limite_admin l;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid804&quot;&gt;&lt;em&gt;INSERT INTO r500_noeuds select ST_Line_Interpolate_Point(l.wkb_geometry,1) as pt, null, null from r500_limite_admin l;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid1066&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid805&quot;&gt;puis déterminer les communes se rencontrant sur ces nœuds...&lt;/div&gt;&lt;div id=&quot;magicdomid821&quot;&gt;&lt;em&gt;INSERT INTO r500_noeuds select pt, count(distinct(insee_comm)), string_agg(distinct(insee_comm),&#039; &#039; order by insee_comm) as insee from r500_noeuds join r500_communes c on (st_touches(pt,wkb_geometry)) join r500_communes_noeuds n on (n.id_rte500=c.id_rte500) group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid1063&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid830&quot;&gt;et faire un petit nettoyage final:&lt;/div&gt;&lt;div id=&quot;magicdomid841&quot;&gt;&lt;em&gt;DELETE FROM r500_noeuds where nb is null;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid846&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1060&quot;&gt;La table ainsi générée contient 72598 nœuds (Route500 2013) avec:&lt;/div&gt;&lt;div id=&quot;magicdomid43&quot;&gt;&lt;ul&gt;&lt;li&gt;le noeud d&#039;intersection&lt;/li&gt;&lt;li&gt;le nombre de communes touchant cette intersection: 1 pour les iles, enclaves et exclaves, 2 pour les communes du littoral et frontalières, 3 ou plus pour les autres (il y en a seulement 4 qui sont à l&#039;intersection de5 communes, et 1 à l&#039;intersection de 6 communes)&lt;/li&gt;&lt;li&gt;les codes INSEE des communes correspondantes (triés par ordre croissant)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid46&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid259&quot;&gt;&lt;strong&gt;Création de la table des nœuds d&#039;intersection OSM&lt;/strong&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid354&quot;&gt; &lt;/div&gt;&lt;div&gt;L&lt;span style=&quot;font-size: 12px;&quot;&gt;a table possède la même structure (noeud, nombre de communes, codes insee).&lt;/span&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid355&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid251&quot;&gt;&lt;em&gt;CREATE TABLE osm_noeuds (pt geometry, nb integer, insee text);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid681&quot;&gt;&lt;em&gt;CREATE INDEX on osm_noeuds  using gist(pt);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid683&quot;&gt;&lt;em&gt;CREATE INDEX on osm_noeuds (insee);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid479&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid425&quot;&gt;Pour accélérer les traitements on va créer une table temporaire ne contenant que les polygones des limites administratives:&lt;/div&gt;&lt;div id=&quot;magicdomid427&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid469&quot;&gt;&lt;em&gt;CREATE TEMP TABLE osm_communes as (select &quot;ref:INSEE&quot; as insee, way FROM planet_osm_polygon WHERE boundary is not null and boundary=&#039;administrative&#039; and admin_level=&#039;8&#039; and &quot;ref:INSEE&quot; is not null);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid466&quot;&gt;&lt;em&gt;CREATE INDEX on osm_communes using gist(way);&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid483&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid517&quot;&gt;Pour la suite, je n&#039;ai rien trouvé de très optimisé (pour l&#039;instant) et donc...&lt;/div&gt;&lt;div id=&quot;magicdomid519&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid523&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, null, null from (select  st_line_interpolate_point((st_dump(st_linemerge(st_intersection(c.way,l.way)))).geom,0) as pt  from osm_communes l join osm_communes c on (st_touches(c.way,l.way) and c.insee &amp;gt; l.insee)) as lim group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid524&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, null, null from (select st_line_interpolate_point((st_dump(st_linemerge(st_intersection(c.way,l.way)))).geom,1) as pt  from osm_communes l join osm_communes c on (st_touches(c.way,l.way) and c.insee &amp;gt; l.insee)) as lim group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid550&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid562&quot;&gt;Puis on dédoublonne...&lt;/div&gt;&lt;div id=&quot;magicdomid564&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid568&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, 0,null from osm_noeuds group by pt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;DELETE FROM osm_noeuds where nb is null;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid584&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid622&quot;&gt;Ne reste plus qu&#039;à reprendre chaque nœud pour trouver les communes qui s&#039;y rejoignent:&lt;/div&gt;&lt;div id=&quot;magicdomid624&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid673&quot;&gt;&lt;em&gt;INSERT INTO osm_noeuds select pt, count(*), string_agg(c.insee,&#039; &#039; order by c.insee) as insee from osm_noeuds join osm_communes c on (st_touches(pt,way)) group by pt;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid675&quot;&gt;&lt;em&gt;DELETE FROM osm_noeuds where nb=0;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid634&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid917&quot;&gt;La structure des tables r500_noeuds et osm_noeuds sont donc identiques et on peut commencer les comparaisons... et sortir par exemple la liste des 100 plus gros écarts :&lt;/div&gt;&lt;div id=&quot;magicdomid891&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid925&quot;&gt;&lt;em&gt;SELECT r.insee, min(st_distance(st_transform(r.pt,2154),st_transform(o.pt,2154))) as d from r500_noeuds r join osm_noeuds o on (r.insee=o.insee) group by r.insee order by d desc limit 100;&lt;/em&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid928&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1044&quot;&gt;&lt;strong&gt;&lt;a name=&quot;fin&quot; id=&quot;fin&quot;&gt;&lt;/a&gt;Résultat&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid969&quot;&gt;Un fichier CSV contenant le résultat de cette dernière requête est disponible et mis à jour chaque nuit sur: &lt;a title=&quot;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&quot; href=&quot;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&quot;&gt;http://osm13.openstreetmap.fr/~cquest/openfla/ecarts-osm-route500.csv&lt;/a&gt;&lt;/div&gt;&lt;div id=&quot;magicdomid971&quot;&gt; &lt;/div&gt;&lt;div id=&quot;magicdomid1029&quot;&gt;Il contient donc:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;l&#039;écart dont la valeur médiane est de &lt;span style=&quot;text-decoration: underline;&quot;&gt;22m&lt;/span&gt; (50% des écarts sont inférieurs à 22m)&lt;/li&gt;&lt;li&gt;les codes INSEE des communes à l&#039;intersection (séparés par un espace).&lt;/li&gt;&lt;/ul&gt;Il ne reste plus qu&#039;à analyser plus en détail ces écarts et à vérifier les plus importants... un travail de fourmis, mais ça c&#039;est notre spécialité !!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Voici une visualisation colorée de ces écarts produite par une nouvelle &lt;a href=&quot;http://tile.openstreetmap.fr/?zoom=7&amp;amp;lat=47.19063&amp;amp;lon=3.25498&amp;amp;layers=B0000000FFFTF&quot;&gt;couche disponible sur tile.openstreetmap.fr&lt;/a&gt;  &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://tile.openstreetmap.fr/?zoom=7&amp;amp;lat=47.19063&amp;amp;lon=3.25498&amp;amp;layers=B0000000FFFTF&quot;&gt;&lt;img style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; src=&quot;/f/img/2013-11/openfla-route500_0.jpg&quot; alt=&quot;&quot; width=&quot;600&quot; height=&quot;577&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;A propos de cette couche carto, lire : &lt;a href=&quot;http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr#Couche_.22Limites_administratives_FR.22&quot;&gt;http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr#Couc...&lt;/a&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/tags/qualit&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;qualité&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;translation_en first last&quot;&gt;&lt;a href=&quot;/node/18532&quot; title=&quot;Quality control on french OSM administrative boundaries&quot; class=&quot;translation-link&quot;&gt;English&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
 <pubDate>Wed, 20 Nov 2013 20:08:24 +0000</pubDate>
 <dc:creator>cquest</dc:creator>
 <guid isPermaLink="false">18531 at http://prev.openstreetmap.fr</guid>
 <comments>http://prev.openstreetmap.fr/blogs/cquest/controle-qualite-limites-administratives-osm#comments</comments>
</item>
</channel>
</rss>
