﻿{"id":10813,"date":"2023-06-20T09:00:00","date_gmt":"2023-06-20T07:00:00","guid":{"rendered":"https:\/\/www.sigterritoires.fr\/?p=10813"},"modified":"2023-06-22T10:32:06","modified_gmt":"2023-06-22T08:32:06","slug":"eliminate-overlaps-and-gaps-between-polygons-in-a-layer-with-qgis-and-postgis","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/eliminate-overlaps-and-gaps-between-polygons-in-a-layer-with-qgis-and-postgis\/","title":{"rendered":"Eliminate overlaps and gaps between polygons in a layer (with QGis and Postgis)"},"content":{"rendered":"\n<p>For those unfamiliar with the joys of working with the French cadastre, you should know that if you have the opportunity to work with cadastral data corresponding to \u00ab\u00a0Lieux-dits\u00a0\u00bb (a subdivision of communes) you&rsquo;ll find that spatial coherence (topology) isn&rsquo;t really respected:<\/p>\n\n\n\n<!--more-->\n\n\n\n<p> <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"384\" data-attachment-id=\"10695\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a1-10\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?fit=3025%2C1813&amp;ssl=1\" data-orig-size=\"3025,1813\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?fit=640%2C384&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=640%2C384&#038;ssl=1\" alt=\"\" class=\"wp-image-10695\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=1024%2C614&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=768%2C460&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=1536%2C921&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=2048%2C1227&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a1.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>In fact, the boundary of each locality is the edge of the adjoining road, leaving empty spaces where the roads are. While this may not be a problem in some cases, it becomes one when you add the \u00ab\u00a0Communes\u00a0\u00bb layer (from the same cadastre) to your map:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"381\" data-attachment-id=\"10696\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a2-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?fit=3013%2C1793&amp;ssl=1\" data-orig-size=\"3013,1793\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?fit=640%2C381&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=640%2C381&#038;ssl=1\" alt=\"\" class=\"wp-image-10696\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=1024%2C609&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=300%2C179&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=768%2C457&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=1536%2C914&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=2048%2C1219&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=150%2C89&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a2.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>At this scale it doesn&rsquo;t look very clean, but if you zoom in it&rsquo;s even worse.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"374\" data-attachment-id=\"10697\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a3-13\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?fit=3031%2C1769&amp;ssl=1\" data-orig-size=\"3031,1769\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?fit=640%2C374&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=640%2C374&#038;ssl=1\" alt=\"\" class=\"wp-image-10697\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=1024%2C598&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=300%2C175&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=768%2C448&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=1536%2C896&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=2048%2C1195&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=150%2C88&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?resize=250%2C146&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>Et si on And if we look at the locality layer itself, we find numerous topological anomalies:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"383\" data-attachment-id=\"10698\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a4-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?fit=3035%2C1813&amp;ssl=1\" data-orig-size=\"3035,1813\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?fit=640%2C383&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=640%2C383&#038;ssl=1\" alt=\"\" class=\"wp-image-10698\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=1024%2C612&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=300%2C179&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=768%2C459&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=1536%2C918&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=2048%2C1223&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a4.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>Yes, it&rsquo;s the official land registry\u2026<\/p>\n\n\n\n<p>Here&rsquo;s how to solve both problems:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How to correct the topology of the lieux-dits layer by removing overlapping polygons and empty spaces between them;<\/li>\n\n\n\n<li>How to recreate a common layer consistent with the new locality layer and superimposed exactly on the locality boundaries.<\/li>\n<\/ul>\n\n\n\n<p>The following example was created using data from the official cadastre of the 71 department, downloaded from the following link <a href=\"https:\/\/cadastre.data.gouv.fr\/data\/etalab-cadastre\/2023-01-01\/shp\/departements\/71\/\">https:\/\/cadastre.data.gouv.fr\/data\/etalab-cadastre\/2023-01-01\/shp\/departements\/71\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to correct the topology of the locality layer<\/h2>\n\n\n\n<p>The solution proposed here requires a PostgreSQL with <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/starting-with-postgres-postgis\/\">Postgis<\/a> database. It is possible to adapt it to SQLite to use a <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/geopackage-format-and-qgis-3\/\">geopackage<\/a> file and the QGis DB Manager. But you have to expect very long processing times and work around a few shortcomings and bugs. We&rsquo;ll look at the best solution here, but we&rsquo;ll present the solution with Geopackage in another article.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1-Create a layer with a buffer around localities<\/h3>\n\n\n\n<p>When it comes to managing the spaces between polygons, even if some snapping tools can be used to deal with certain problems, the simplest and most radical solution is to build a buffer around the polygons, so as to transform empty spaces into superimpositions. In the case of localities, empty spaces are of the order of 10m. We build a 6m buffer around the localities, which will give an overlay of the order of 2-3 meters minimum.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"316\" data-attachment-id=\"10699\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a5-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?fit=1663%2C821&amp;ssl=1\" data-orig-size=\"1663,821\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?fit=640%2C316&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=640%2C316&#038;ssl=1\" alt=\"\" class=\"wp-image-10699\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=1024%2C506&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=768%2C379&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=1536%2C758&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=150%2C74&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?resize=250%2C123&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?w=1663&amp;ssl=1 1663w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a5.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"333\" data-attachment-id=\"10700\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a6-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?fit=2225%2C1155&amp;ssl=1\" data-orig-size=\"2225,1155\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?fit=640%2C333&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=640%2C333&#038;ssl=1\" alt=\"\" class=\"wp-image-10700\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=1024%2C532&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=300%2C156&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=768%2C399&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=1536%2C797&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=2048%2C1063&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=150%2C78&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?resize=250%2C130&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a6.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>Choose a permanent output file in Geopackage format, which will allow you to follow the procedure in the next step without modification.<\/p>\n\n\n\n<p>The result of the buffer layer is as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"382\" data-attachment-id=\"10701\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a7-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?fit=2560%2C1529&amp;ssl=1\" data-orig-size=\"2560,1529\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?fit=640%2C382&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7.jpg?resize=640%2C382&#038;ssl=1\" alt=\"\" class=\"wp-image-10701\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=1024%2C611&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=300%2C179&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=768%2C459&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=1536%2C917&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=2048%2C1223&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a7-scaled.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"388\" data-attachment-id=\"10702\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a8-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?fit=2985%2C1809&amp;ssl=1\" data-orig-size=\"2985,1809\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?fit=640%2C388&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=640%2C388&#038;ssl=1\" alt=\"\" class=\"wp-image-10702\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=1024%2C621&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=300%2C182&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=768%2C465&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=1536%2C931&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=2048%2C1241&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=150%2C91&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?resize=248%2C150&amp;ssl=1 248w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a8.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>We no longer have to manage spaces between polygons, we only have overlays.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2- Load the lieux-dits layer into PostgreSQL<\/h3>\n\n\n\n<p>You can read more about how to load the layer in the article <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/loading-geopackage-data-into-postreql-postgis-with-qgis\/\" title=\"How to load a geopackage in Postgis with QGis\">How to load a geopackage in Postgis with QGis<\/a> . Use the same procedure to load shapefiles.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"379\" data-attachment-id=\"10703\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a9-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?fit=3157%2C1871&amp;ssl=1\" data-orig-size=\"3157,1871\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a9\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?fit=640%2C379&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=640%2C379&#038;ssl=1\" alt=\"\" class=\"wp-image-10703\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=1024%2C607&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=768%2C455&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=1536%2C910&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=2048%2C1214&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=150%2C89&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?resize=250%2C148&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a9.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>And you can find your table in PostreSQL with pgAdmin<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"415\" data-attachment-id=\"10704\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a10-6\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?fit=3135%2C2033&amp;ssl=1\" data-orig-size=\"3135,2033\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a10\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?fit=640%2C415&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=640%2C415&#038;ssl=1\" alt=\"\" class=\"wp-image-10704\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=1024%2C664&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=300%2C195&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=768%2C498&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=1536%2C996&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=2048%2C1328&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=150%2C97&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?resize=231%2C150&amp;ssl=1 231w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a10.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3- Running the SQL script<\/h3>\n\n\n\n<p>We&rsquo;re going to use a single script to do all the work:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We create a view with two collections of geometries. Initially, these are the polygons of the localities in duplicate.<\/li>\n\n\n\n<li>The first collection contains those parts of the polygons that don&rsquo;t overlap with any others.<\/li>\n\n\n\n<li>the overlapping parts are kept in the second collection<\/li>\n\n\n\n<li>We add the superimposed part to the smaller of the two polygons concerned by the superimposition.<\/li>\n<\/ul>\n\n\n\n<p>Here&rsquo;s the script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DROP TABLE IF EXISTS table_corrigee ; \n\nCREATE OR REPLACE VIEW auto_jointure AS SELECT\n\n    tampon.id as id,\n    tampon.nom as \"nom\",\n    tampon.commune as \"commune\",\n-- we retrieve all the polygons from the buffer table in two collections: one containing the complete geometries and another containing the superimposed parts. For the moment, both collections contain the complete geometries.\n    ST_Union(tampon.geom) AS full_geom,\n    ST_Union(tampon_bis.geom) AS shared_geom\n    FROM  tampon ,tampon AS tampon_bis\n    WHERE\n      --check polygon validity as follows\n      ST_IsValid(tampon.geom) AND ST_IsValid(tampon_bis.geom)\n      --filter to retain intersecting polygons\n      AND ST_intersects(tampon.geom,tampon_bis.geom)   \n      --eliminate intersecting polygons\n      AND tampon.id &lt;&gt; tampon_bis.id          \n      --for an intersection of 2 polygons, keep only the smaller one\n      AND ST_Area(tampon_bis.geom) &lt; ST_Area(tampon.geom)\n      --since we're making \"unions\", we need to perform a grouping on the other attributes\n    GROUP BY tampon.id,tampon.\"nom\" , tampon.commune ;\n\/*\nWe'll create a table containing the final result: the first step is to remove all overlapping areas. The second step consists in adding the overlapping areas to the smaller of the two polygons. The holes created by the first step are filled by the second step. The final polygons are seamless, with no overlaps or gaps.\n*\/\n\n    CREATE TABLE table_corrigee AS SELECT\n    id,\n    \"nom\",\n    commune,\n\/* Intersections are subtracted from the layer containing all polygons, thus removing conflicting parts*\/\n    ST_Multi(ST_Difference(full_geom,shared_geom)) as geom,\n    ST_Area(full_geom) as area\n    FROM auto_jointure\n    WHERE ST_IsValid(full_geom) AND ST_IsValid(shared_geom)\n\/*The intersections just subtracted must then be added to fill the spaces created*\/\n    UNION \n      SELECT\n      id,\n      \"nom\",\n      commune,\n      geom,\n      ST_Area(geom)\n      FROM tampon\n      WHERE id NOT IN (SELECT id FROM auto_jointure);\n\/*A primary key is then redefined so that QGIS can load the layer.*\/\n\nALTER TABLE table_corrigee ADD CONSTRAINT pk_table_corrigee PRIMARY KEY (id);\n<\/code><\/pre>\n\n\n\n<p>To adapt the script to your case, you need to replace the following elements with a word processor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>all occurrences of <strong><em>tampon <\/em><\/strong>by the name of your table containing the buffered edit_locations,<\/li>\n\n\n\n<li>all occurrences of <strong><em>table_corrigee <\/em><\/strong>with the name of your desired result table,<\/li>\n\n\n\n<li>and check that the identifier of your buffered table is <strong><em>id<\/em><\/strong>. By default, it can be named <strong><em>fid<\/em><\/strong>. In this case, replace all occurrences of <strong><em>id<\/em><\/strong> with <strong><em>fid<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>Load the new layer into QGis:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"361\" data-attachment-id=\"10710\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a11-6\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?fit=3807%2C2149&amp;ssl=1\" data-orig-size=\"3807,2149\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a11\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?fit=640%2C361&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=640%2C361&#038;ssl=1\" alt=\"\" class=\"wp-image-10710\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=1024%2C578&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=768%2C434&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=1536%2C867&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=2048%2C1156&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=150%2C85&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?resize=250%2C141&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a11.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"191\" data-attachment-id=\"10712\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a12-6\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?fit=2560%2C764&amp;ssl=1\" data-orig-size=\"2560,764\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a12\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?fit=640%2C191&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12.jpg?resize=640%2C191&#038;ssl=1\" alt=\"\" class=\"wp-image-10712\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=1024%2C305&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=300%2C89&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=768%2C229&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=1536%2C458&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=2048%2C611&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=150%2C45&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?resize=250%2C75&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a12-scaled.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption class=\"wp-element-caption\"><br>Left: corrected layer, right: original locality layer<\/figcaption><\/figure>\n<\/div>\n\n\n<p>We&rsquo;ve solved the problem of the topological consistency of localities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to recreate a communes layer consistent with the new lieux-dits layer<\/h2>\n\n\n\n<p>If we superimpose the cadastral commune boundaries on our new layer, we can see that they are not consistent with our new lieux-dits, just as they are not consistent with the original lieux-dits.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"393\" data-attachment-id=\"10713\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a13-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?fit=3023%2C1857&amp;ssl=1\" data-orig-size=\"3023,1857\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a13-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?fit=640%2C393&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=640%2C393&#038;ssl=1\" alt=\"\" class=\"wp-image-10713\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=1024%2C629&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=300%2C184&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=768%2C472&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=1536%2C944&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=2048%2C1258&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=150%2C92&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?resize=244%2C150&amp;ssl=1 244w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a13-1.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>To obtain coherent communal boundaries, it would be sufficient to group the lieux-dits by commune. The problem is that not all communal areas are divided into lieux-dits. We therefore have \u00ab\u00a0holes\u00a0\u00bb in the lieux-dits layer, which are perfectly normal.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"388\" data-attachment-id=\"10714\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a14-7\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?fit=2560%2C1553&amp;ssl=1\" data-orig-size=\"2560,1553\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a14\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?fit=640%2C388&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14.jpg?resize=640%2C388&#038;ssl=1\" alt=\"\" class=\"wp-image-10714\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=1024%2C621&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=300%2C182&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=768%2C466&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=1536%2C932&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=2048%2C1242&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=150%2C91&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?resize=247%2C150&amp;ssl=1 247w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a14-scaled.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>To build complete communes, first create the missing locality polygons, assigning the corresponding commune code, then group the localities together using the commune attribute.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1-Creating the missing polygons<\/h3>\n\n\n\n<p>First of all, we&rsquo;ll create a new polygon layer, <strong><em>emprise<\/em><\/strong>, with a single polygon that completely surrounds our lieux-dits layer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"585\" data-attachment-id=\"10715\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a15-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?fit=1237%2C1131&amp;ssl=1\" data-orig-size=\"1237,1131\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a15\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?fit=640%2C585&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=640%2C585&#038;ssl=1\" alt=\"\" class=\"wp-image-10715\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=1024%2C936&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=300%2C274&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=768%2C702&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=150%2C137&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?resize=164%2C150&amp;ssl=1 164w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a15.png?w=1237&amp;ssl=1 1237w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"384\" data-attachment-id=\"10716\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a16-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?fit=2560%2C1535&amp;ssl=1\" data-orig-size=\"2560,1535\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a16\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?fit=640%2C384&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16.jpg?resize=640%2C384&#038;ssl=1\" alt=\"\" class=\"wp-image-10716\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=1024%2C614&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=768%2C460&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=1536%2C921&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=2048%2C1228&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a16-scaled.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>We then use the \u00ab\u00a0Difference\u00a0\u00bb treatment to keep only the <strong><em>emprise <\/em><\/strong>zones that don&rsquo;t correspond to the existing lieux-dits in our corrected_table:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"370\" data-attachment-id=\"10717\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a17-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?fit=2989%2C1729&amp;ssl=1\" data-orig-size=\"2989,1729\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a17-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?fit=640%2C370&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=640%2C370&#038;ssl=1\" alt=\"\" class=\"wp-image-10717\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=1024%2C592&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=300%2C174&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=768%2C444&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=1536%2C889&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=2048%2C1185&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=150%2C87&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?resize=250%2C145&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a17-1.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>You can leave the output of the treatments as temporary layers, as you won&rsquo;t have any further use for them after the final result.<\/p>\n\n\n\n<p>The result of the difference is:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"386\" data-attachment-id=\"10718\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a18-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?fit=2999%2C1809&amp;ssl=1\" data-orig-size=\"2999,1809\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?fit=640%2C386&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=640%2C386&#038;ssl=1\" alt=\"\" class=\"wp-image-10718\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=1024%2C618&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=300%2C181&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=768%2C463&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=1536%2C927&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=2048%2C1235&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a18.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>The result is a single multipolygon\u2026 Before continuing, we need to change this multipolygon layer to single polygons, so that we can remove the area outline.<\/p>\n\n\n\n<p>We use single-piece-to-multi-piece processing<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"381\" data-attachment-id=\"10719\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a19-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?fit=1711%2C1017&amp;ssl=1\" data-orig-size=\"1711,1017\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a19\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?fit=640%2C381&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=640%2C381&#038;ssl=1\" alt=\"\" class=\"wp-image-10719\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=1024%2C609&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=768%2C456&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=1536%2C913&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=150%2C89&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?w=1711&amp;ssl=1 1711w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a19.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>Once the processing is complete, switch the result to edit mode and select the outer polygon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"392\" data-attachment-id=\"10720\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a20-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?fit=2989%2C1829&amp;ssl=1\" data-orig-size=\"2989,1829\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a20\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?fit=640%2C392&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=640%2C392&#038;ssl=1\" alt=\"\" class=\"wp-image-10720\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=1024%2C627&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=300%2C184&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=768%2C470&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=1536%2C940&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=2048%2C1253&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=150%2C92&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?resize=245%2C150&amp;ssl=1 245w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a20.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>And it&rsquo;s being removed:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"400\" data-attachment-id=\"10721\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a21-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?fit=2829%2C1769&amp;ssl=1\" data-orig-size=\"2829,1769\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a21\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?fit=640%2C400&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=640%2C400&#038;ssl=1\" alt=\"\" class=\"wp-image-10721\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=1024%2C640&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=768%2C480&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=1536%2C960&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=2048%2C1281&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=150%2C94&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?resize=240%2C150&amp;ssl=1 240w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a21.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>So now we have a <strong><em>Simple Geometries layer<\/em><\/strong> containing all the places where there are no localities, and a layer of corrected localities. We merge the two layers into one, which will no longer have any holes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"309\" data-attachment-id=\"10722\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a22-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?fit=1723%2C833&amp;ssl=1\" data-orig-size=\"1723,833\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a22\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?fit=640%2C309&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=640%2C309&#038;ssl=1\" alt=\"\" class=\"wp-image-10722\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=1024%2C495&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=300%2C145&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=768%2C371&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=1536%2C743&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=150%2C73&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?resize=250%2C121&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?w=1723&amp;ssl=1 1723w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a22.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"420\" data-attachment-id=\"10723\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a23-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?fit=2560%2C1679&amp;ssl=1\" data-orig-size=\"2560,1679\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a23\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?fit=640%2C420&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23.jpg?resize=640%2C420&#038;ssl=1\" alt=\"\" class=\"wp-image-10723\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=1024%2C672&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=300%2C197&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=768%2C504&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=1536%2C1007&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=2048%2C1343&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=150%2C98&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?resize=229%2C150&amp;ssl=1 229w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a23-scaled.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>We still need to resolve the problem of attributes for polygons that are not localities. They must have an attribute containing the commune code, so that grouping by commune can take place.<\/p>\n\n\n\n<p>We will use the communes layer of the cadastre and perform a join by location with the new merged layer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"296\" data-attachment-id=\"10724\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a24-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?fit=1635%2C757&amp;ssl=1\" data-orig-size=\"1635,757\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?fit=640%2C296&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=640%2C296&#038;ssl=1\" alt=\"\" class=\"wp-image-10724\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=1024%2C474&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=300%2C139&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=768%2C356&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=1536%2C711&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=150%2C69&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?resize=250%2C116&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?w=1635&amp;ssl=1 1635w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a24.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"342\" data-attachment-id=\"10725\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a25-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?fit=2217%2C1185&amp;ssl=1\" data-orig-size=\"2217,1185\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a25\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?fit=640%2C342&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=640%2C342&#038;ssl=1\" alt=\"\" class=\"wp-image-10725\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=1024%2C547&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=300%2C160&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=768%2C411&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=1536%2C821&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=2048%2C1095&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=150%2C80&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?resize=250%2C134&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a25.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>We now have the joined table:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"277\" data-attachment-id=\"10726\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a26-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?fit=3471%2C1501&amp;ssl=1\" data-orig-size=\"3471,1501\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a26\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?fit=640%2C277&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=640%2C277&#038;ssl=1\" alt=\"\" class=\"wp-image-10726\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=1024%2C443&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=300%2C130&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=768%2C332&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=1536%2C664&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=2048%2C886&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=150%2C65&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?resize=250%2C108&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a26.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>In this image, the first five records correspond to areas that are not lieux-dits. The Commune attribute, which is of interest to us in the next step, is not filled in. However, the id2 attribute, which comes from the location-based join with the communes layer, is filled in.<\/p>\n\n\n\n<p>Open the table in edit mode. Use an expression to select the records that do not have the commune attribute filled in, then open the field calculator and update the commune field with the contents of id2.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"264\" data-attachment-id=\"10727\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a27-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?fit=3509%2C1449&amp;ssl=1\" data-orig-size=\"3509,1449\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a27\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?fit=640%2C264&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=640%2C264&#038;ssl=1\" alt=\"\" class=\"wp-image-10727\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=1024%2C423&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=300%2C124&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=768%2C317&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=1536%2C634&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=2048%2C846&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=150%2C62&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?resize=250%2C103&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a27.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"291\" data-attachment-id=\"10728\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a28-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?fit=3341%2C1519&amp;ssl=1\" data-orig-size=\"3341,1519\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a28\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?fit=640%2C291&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=640%2C291&#038;ssl=1\" alt=\"\" class=\"wp-image-10728\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=1024%2C466&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=300%2C136&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=768%2C349&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=1536%2C698&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=2048%2C931&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=150%2C68&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?resize=250%2C114&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a28.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"254\" data-attachment-id=\"10729\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a29-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?fit=3187%2C1263&amp;ssl=1\" data-orig-size=\"3187,1263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a29\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?fit=640%2C254&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=640%2C254&#038;ssl=1\" alt=\"\" class=\"wp-image-10729\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=1024%2C406&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=300%2C119&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=768%2C304&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=1536%2C609&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=2048%2C812&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=150%2C59&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?resize=250%2C99&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a29.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>Now we can group the lieux-dits by commune to obtain our communes layer consistent with the lieux-dits.<\/p>\n\n\n\n<p>We use the Group treatment, with the layer resulting from the join we&rsquo;ve just modified.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"343\" data-attachment-id=\"10730\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a30-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?fit=2211%2C1183&amp;ssl=1\" data-orig-size=\"2211,1183\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a30\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?fit=640%2C343&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=640%2C343&#038;ssl=1\" alt=\"\" class=\"wp-image-10730\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=1024%2C548&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=300%2C161&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=768%2C411&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=1536%2C822&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=2048%2C1096&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=150%2C80&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?resize=250%2C134&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a30.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>So we have our new communes. We now have one last operation to perform. As with all mergers, there are a few small drosses that need to be eliminated:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"386\" data-attachment-id=\"10731\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a31-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?fit=3005%2C1813&amp;ssl=1\" data-orig-size=\"3005,1813\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a31\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?fit=640%2C386&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=640%2C386&#038;ssl=1\" alt=\"\" class=\"wp-image-10731\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=1024%2C618&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=300%2C181&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=768%2C463&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=1536%2C927&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=2048%2C1236&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?resize=250%2C150&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a31.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>To do this, we&rsquo;ll use the Remove Holes treatment.<\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\">Don&rsquo;t forget to save the result in a permanent file &#8211; it would be hard to have to redo everything!<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"335\" data-attachment-id=\"10732\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a32-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?fit=2227%2C1165&amp;ssl=1\" data-orig-size=\"2227,1165\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a32\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?fit=640%2C335&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=640%2C335&#038;ssl=1\" alt=\"\" class=\"wp-image-10732\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=1024%2C536&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=300%2C157&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=768%2C402&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=1536%2C804&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=2048%2C1071&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=150%2C78&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?resize=250%2C131&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a32.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"391\" data-attachment-id=\"10733\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a33\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?fit=2913%2C1777&amp;ssl=1\" data-orig-size=\"2913,1777\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a33\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?fit=640%2C391&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=640%2C391&#038;ssl=1\" alt=\"\" class=\"wp-image-10733\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=1024%2C625&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=300%2C183&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=768%2C468&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=1536%2C937&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=2048%2C1249&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=150%2C92&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?resize=246%2C150&amp;ssl=1 246w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a33.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n\n\n\n<p>We can now compare the result of our new common layer with the original layer<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"196\" data-attachment-id=\"10734\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/eliminer-les-superpositions-et-les-espaces-entre-polygones-dans-une-coucheavec-qgis-et-postgis\/a34\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?fit=5945%2C1823&amp;ssl=1\" data-orig-size=\"5945,1823\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"a34\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?fit=640%2C196&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=640%2C196&#038;ssl=1\" alt=\"\" class=\"wp-image-10734\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=1024%2C314&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=300%2C92&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=768%2C236&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=1536%2C471&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=2048%2C628&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=150%2C46&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?resize=250%2C77&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a34.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><figcaption class=\"wp-element-caption\">On the left is the original cadastral layer, on the right the layer we&rsquo;ve built.<\/figcaption><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>For those unfamiliar with the joys of working with the French cadastre, you should know that if you have the opportunity to work with cadastral data corresponding to \u00ab\u00a0Lieux-dits\u00a0\u00bb (a subdivision of communes) you&rsquo;ll find that&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10845,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1338,1377,1381],"tags":[2200,2194,1347,1995,2190,2196,2192,1349,1386,2184,2186,2188,2198],"class_list":["post-10813","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgresql-en","category-qgis-en","category-spatialite","tag-cartographic-visualization","tag-geographic-research","tag-geometry","tag-geopackage-en","tag-geospatial-modelling","tag-gis-geographic-information-system","tag-polygons","tag-postgis-en","tag-qgis-en","tag-spatial-analysis","tag-spatial-data","tag-territorial-management","tag-territories"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2023\/06\/a3-3.png?fit=3031%2C1769&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-2Op","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/10813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=10813"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/10813\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media\/10845"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=10813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=10813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=10813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}