﻿{"id":3679,"date":"2017-01-05T13:51:53","date_gmt":"2017-01-05T12:51:53","guid":{"rendered":"http:\/\/www.sigterritoires.fr\/?p=3679"},"modified":"2017-01-08T15:14:48","modified_gmt":"2017-01-08T14:14:48","slug":"jointures-1-n-dans-qgis-les-couches-virtuelles","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/","title":{"rendered":"Jointures 1-n dans QGis: les couches virtuelles"},"content":{"rendered":"<p>Une des techniques les plus r\u00e9pandues en <a href=\"https:\/\/www.sigterritoires.fr\/\">SIG<\/a> pour pouvoir traiter des donn\u00e9es non spatiales est celle de la <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/jointure-table-qgis\/\">jointure<\/a>. On utilise une couche g\u00e9ographique, poss\u00e9dant des g\u00e9om\u00e9tries, comme support d&rsquo;une autre couche ne poss\u00e9dant pas de donn\u00e9es de localisation. Pour faire cela, on utilise un champ commun aux deux tables, qui permet de \u00ab\u00a0joindre\u00a0\u00bb les enregistrements de la table g\u00e9ographique \u00e0 ceux de la table non g\u00e9ographique. On cr\u00e9\u00e9 ainsi une nouvelle table virtuelle ou les attributs de la table non g\u00e9ographique peuvent \u00eatre utilis\u00e9s pour \u00eatre cartographi\u00e9s avec la g\u00e9om\u00e9trie de la premi\u00e8re table. Pour que cette jointure marche il faut que pour un enregistrement de la table g\u00e9ographique on retrouve un enregistrement dans la table non g\u00e9ographique, ou qu&rsquo;on n&rsquo;en trouve pas. Car si l&rsquo;on trouve plus d&rsquo;un, la jointure ne peut pas marcher. On parle alors de \u00ab\u00a0relation\u00a0\u00bb entre les tables et non de \u00ab\u00a0jointure\u00a0\u00bb.<!--more--><\/p>\n<p>Pendant longtemps, les logiciels SIG n&rsquo;ont permis que de travailler avec des jointures. Les relations ne supportaient pas la plupart des op\u00e9rateurs spatiaux applicables aux jointures.<\/p>\n<p>Une des raisons de cette limitation \u00e9tait le sous-ensemble restreint du langage SQL applicable aux couches g\u00e9ographiques. Que ce soit sur les fichiers <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/frshapefile-vs-geopackage-quel-format-choisir\/\">shapefile<\/a>, ou autres, les requ\u00eates applicables se limitaient \u00e0 une clause pr\u00e9format\u00e9e\u00a0 de type \u00ab\u00a0SELECT * FROM la_table WHERE\u00a0\u00bb et o\u00f9 on pouvait construire la fin de la requ\u00eate, c&rsquo;est \u00e0 dire la clause WHERE.<\/p>\n<p>Pour pouvoir cr\u00e9er une table virtuelle avec plusieurs enregistrements de la table B correspondants \u00e0 un enregistrement de la table A (cardinalit\u00e9 de type 1,n) il faut utiliser la capacit\u00e9 de jointure de tables du SQL et donc, utiliser deux tables dans la requ\u00eate. Ceci est possible dans QGis aujourd&rsquo;hui (\u00e7a n&rsquo;a pas toujours \u00e9t\u00e9 le cas), en utilisant les \u00ab\u00a0couches virtuelles\u00a0\u00bb. Elles sont apparues sous forme de plugin dans la version 2.10, et int\u00e9gr\u00e9es aux corps de QGis dans la version 2.14 .<\/p>\n<h2>Les couches virtuelles de QGis<\/h2>\n<h3>Fonctionnalit\u00e9s des couches virtuelles<\/h3>\n<p>\u2022Vous pouvez cr\u00e9er une nouvelle couche virtuelle avec le bouton \u00ab\u00a0New virtual layer\u00a0\u00bb:<a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/z0.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3682\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_z0\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/z0.png?fit=33%2C32&amp;ssl=1\" data-orig-size=\"33,32\" 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=\"_z0\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/z0.png?fit=33%2C32&amp;ssl=1\" class=\"wp-image-3682 size-full alignnone\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/z0.png?resize=33%2C32\" width=\"33\" height=\"32\" \/><\/a><br \/>\n\u2022Une couche virtuelle peut \u00eatre cr\u00e9\u00e9e \u00e0 partir d&rsquo;une s\u00e9lection de couche (clic droit dans la fen\u00eatre couche)<\/p>\n<p>\u2022Si vous voulez filtrer une couche avec une jointure, Qgis proposera de cr\u00e9er une couche virtuelle<\/p>\n<p>\u2022Dans DBMANAGER, il y a une nouvelle entr\u00e9e \u00ab\u00a0Virtual Layers\u00a0\u00bb o\u00f9 vous pouvez utiliser la Fen\u00eatre SQL pour cr\u00e9er une couche virtuelle<\/p>\n<p>La g\u00e9n\u00e9ration des couches virtuelles est sauvegard\u00e9e dans le fichier projet. La couche virtuelle se comporte comme une table native, notamment avec les champs issus d&rsquo;une jointure.<\/p>\n<h3>Utilisation des couches virtuelles<\/h3>\n<p>Prenons un exemple:<\/p>\n<p>Nous disposons d&rsquo;un fichier Excel contenant les diff\u00e9rentes aires communales (campings, grandes surfaces,naturelles, stationnements,&#8230;). Ce tableau a une colonne INSEE o\u00f9 l&rsquo;on trouve le code Insee de la commune sur laquelle se trouve l&rsquo;aire.<\/p>\n<p>Nous disposons d&rsquo;un shapefile des communes sous forme de polygones, dans lequel nous trouvons un attribut INSEE_COM avec le code Insee de la commune.<\/p>\n<p>Ce que nous souhaitons c&rsquo;est d&rsquo;avoir une couche o\u00f9 chaque aire soit repr\u00e9sent\u00e9e par le polygone de la commune correspondante. Au lieu d&rsquo;avoir les X polygones de la couche <em><strong>communes<\/strong> <\/em>nous voulons avoir les Y polygones correspondants aux Y lignes de la table Excel des aires communales.<\/p>\n<p>Nous chargeons la couche Communes dans QGis, ainsi que la table Excel CCAires. Pour charger la table Excel vous devez activer et utiliser le plugin Spreadsheet Layers.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3683\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?fit=1361%2C704&amp;ssl=1\" data-orig-size=\"1361,704\" 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=\"_y1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?fit=640%2C331&amp;ssl=1\" class=\"aligncenter size-large wp-image-3683\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1-1024x530.png?resize=640%2C331\" alt=\"\" width=\"640\" height=\"331\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?resize=1024%2C530&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?resize=768%2C397&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?resize=1200%2C621&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?w=1361&amp;ssl=1 1361w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y1.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>Pour cr\u00e9er la couche virtuelle, on clique sur le bouton <em><strong>Ajouter\/Editer couche virtuelle<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3684\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?fit=1252%2C704&amp;ssl=1\" data-orig-size=\"1252,704\" 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=\"_y2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?fit=640%2C360&amp;ssl=1\" class=\"aligncenter size-large wp-image-3684\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2-1024x576.png?resize=640%2C360\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y2.png?w=1252&amp;ssl=1 1252w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>Nous utilisons le bouton <em><strong>Importer<\/strong> <\/em>pour ajouter les deux couches dans la liste des <em><strong>Couches int\u00e9gr\u00e9es.<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3685\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?fit=889%2C686&amp;ssl=1\" data-orig-size=\"889,686\" 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=\"_y3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?fit=640%2C494&amp;ssl=1\" class=\"aligncenter size-full wp-image-3685\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?resize=640%2C494\" alt=\"\" width=\"640\" height=\"494\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?w=889&amp;ssl=1 889w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?resize=300%2C231&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y3.png?resize=768%2C593&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>Dans la fen\u00eatre Requ\u00eate, on rentre la commande SQL suivante:<\/p>\n<p><em>SELECT * FROM communes29, CCAires\u00a0 where INSEE_COM = INSEE<\/em><\/p>\n<p>Vous pouvez (et devez) tester la syntaxe de votre requ\u00eate SQL avec le bouton <em><strong>Tester<\/strong><\/em><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3686\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y4\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?fit=896%2C691&amp;ssl=1\" data-orig-size=\"896,691\" 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=\"_y4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?fit=640%2C494&amp;ssl=1\" class=\"aligncenter size-full wp-image-3686\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?resize=640%2C494\" alt=\"\" width=\"640\" height=\"494\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?w=896&amp;ssl=1 896w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?resize=300%2C231&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y4.png?resize=768%2C592&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>On clique sur OK et la couche virtuelle est ajout\u00e9e \u00e0 la carte.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3688\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y5\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?fit=1366%2C733&amp;ssl=1\" data-orig-size=\"1366,733\" 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=\"_y5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?fit=640%2C343&amp;ssl=1\" class=\"aligncenter size-large wp-image-3688\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5-1024x549.png?resize=640%2C343\" alt=\"\" width=\"640\" height=\"343\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?resize=1024%2C549&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?resize=300%2C161&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?resize=768%2C412&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?resize=1200%2C644&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?w=1366&amp;ssl=1 1366w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y5.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>Remarquez les deux communes absentes, car elles n&rsquo;ont pas d&rsquo;aire communale dans le fichier Excel.<\/p>\n<p>Si on affiche la table attributaire de la couche virtuelle:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3689\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y6\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?fit=1196%2C606&amp;ssl=1\" data-orig-size=\"1196,606\" 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=\"_y6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?fit=640%2C324&amp;ssl=1\" class=\"aligncenter size-large wp-image-3689\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6-1024x519.png?resize=640%2C325\" alt=\"\" width=\"640\" height=\"325\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?resize=1024%2C519&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?resize=300%2C152&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?resize=768%2C389&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y6.png?w=1196&amp;ssl=1 1196w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>On peut voir que plusieurs enregistrements correspondent \u00e0 une m\u00eame commune, et que le nombre d&rsquo;enregistrements (419) correspond au nombre de lignes du tableau Excel et non au nombre des communes du shapefile (283).<\/p>\n<p>On peut aller plus loin et ajouter une clause WHERE pour ne s\u00e9lectionner qu&rsquo;une partie des aires communales, par exemple les campings<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3690\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y7\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?fit=901%2C688&amp;ssl=1\" data-orig-size=\"901,688\" 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=\"_y7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?fit=640%2C489&amp;ssl=1\" class=\"aligncenter size-full wp-image-3690\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?resize=640%2C489\" alt=\"\" width=\"640\" height=\"489\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?w=901&amp;ssl=1 901w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?resize=300%2C229&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y7.png?resize=768%2C586&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a>On obtient seulement 148 enregistrements, correspondant au nombre de campings pr\u00e9sents dans le tableau Excel.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3691\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/jointures-1-n-dans-qgis-les-couches-virtuelles\/_y8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?fit=1364%2C739&amp;ssl=1\" data-orig-size=\"1364,739\" 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=\"_y8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?fit=640%2C347&amp;ssl=1\" class=\"aligncenter size-large wp-image-3691\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8-1024x555.png?resize=640%2C347\" alt=\"\" width=\"640\" height=\"347\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?resize=1024%2C555&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?resize=300%2C163&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?resize=768%2C416&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?resize=1200%2C650&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?w=1364&amp;ssl=1 1364w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2017\/01\/y8.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Une des techniques les plus r\u00e9pandues en SIG pour pouvoir traiter des donn\u00e9es non spatiales est celle de la jointure. On utilise une couche g\u00e9ographique, poss\u00e9dant des g\u00e9om\u00e9tries, comme support d&rsquo;une autre couche ne poss\u00e9dant pas&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"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":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[152,62],"tags":[351,151,218,58,349,350],"class_list":["post-3679","post","type-post","status-publish","format-standard","hentry","category-outils_divers","category-qgis-2","tag-couche-virtuelle","tag-excel","tag-jointure","tag-qgis","tag-relation","tag-virtual-layer"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-Xl","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/3679","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=3679"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/3679\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=3679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=3679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=3679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}