tag:blogger.com,1999:blog-58818525113712612632024-03-12T17:03:27.074-07:00InSitu SIGIn Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5881852511371261263.post-81271881391374339082017-07-21T00:10:00.000-07:002023-11-26T07:03:30.198-08:00Du temporel dans le spatial ... <div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
Un jour, après une discussion au téléphone avec un stagiaire au sujet de la construction d'une "base spatiale", mon fils qui écoutait d'une oreille indiscrète me regarde avec une grande admiration, et me demande si je vais construire une "vraie base spatiale" (on était en pleine période de matraquage suite à la sortie du dernier épisode de Star Wars ...) ; pas toujours facile de ne pas décevoir un enfant. Alors je lui ai promis de construire non pas une simple "base spatiale" mais une "base spatio-temporelle". Plus dur sera le réveil. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Le SIG pour manipuler et représenter les données spatiales, on voit bien de quoi il s'agit. Mais qu'en est-il de l'utilisation de données temporelles ? Je présente ci-dessous quelques exemples où <i><b>spatial </b></i>et <i><b>temporel </b></i>se mélangent.</div>
<ul style="text-align: justify;">
<li>Tout d'abord, pour pouvoir utiliser une dimension temporelle, il faut que nos données contiennent des informations de type "<b>date</b>". Dans QGIS, au moment de la création d'une couche (ou simplement d'un nouveau champ) de format shape, le type<b> <i>date </i></b>est proposé. Il permet d'enregistrer des données au format américain <i>année-mois-jour</i> (puis de les manipuler avec des fonctions spécifiques aux <i><b>dates</b></i> et aux <i><b>intervalles de temps</b></i>). On verra plus loin comment les afficher au format européen <i>jour-mois-année</i>. </li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj00vfZGx_hlRH41d22lTJCvMIWLQGwkvcpc5XdfSV52uzAbJFiG1s-5UUeKWnYlJn_YXl6u1Q80iOlllFOqXqKrk4eqsj8UOJaI9Lrz1BCU7a2fe08ugHO8TvwyjzvSLdZ001LjbNeCk-b/s1600/nlle_couche_champ_type_date.png" style="margin-left: auto; margin-right: auto;"><img alt="creation couche avec champ date" border="0" data-original-height="228" data-original-width="461" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj00vfZGx_hlRH41d22lTJCvMIWLQGwkvcpc5XdfSV52uzAbJFiG1s-5UUeKWnYlJn_YXl6u1Q80iOlllFOqXqKrk4eqsj8UOJaI9Lrz1BCU7a2fe08ugHO8TvwyjzvSLdZ001LjbNeCk-b/s1600/nlle_couche_champ_type_date.png" title="" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="color: #666666;"><i><span style="background-color: #eeeeee;">Création d'un nouveau champ de type "date"</span></i></span></td></tr>
</tbody></table>
<br />
<div style="text-align: justify;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9HkwnuK405PNIFNs3mXadt08lmIAiC7kYyrZ7VE5mPK9R3zGo_7RGBUqnOHVZa542qY8248gAU78C2gsiHN4SSDRdmTZKSY83qnOqv4ZWoww0uXbZDeJlF4AbtJ9uODPXiPvy7SJmPreJ/s1600/date_format_am.png" style="margin-left: auto; margin-right: auto;"><img alt="date format américain - shp - dbf" border="0" data-original-height="92" data-original-width="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9HkwnuK405PNIFNs3mXadt08lmIAiC7kYyrZ7VE5mPK9R3zGo_7RGBUqnOHVZa542qY8248gAU78C2gsiHN4SSDRdmTZKSY83qnOqv4ZWoww0uXbZDeJlF4AbtJ9uODPXiPvy7SJmPreJ/s1600/date_format_am.png" title="date format américain - shp - dbf" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: #eeeeee;"><span style="color: #666666;"><i><span style="color: #999999;">(à noter que le séparateur standard est le trait d'union)</span></i></span></span></td></tr>
</tbody></table>
</div>
<ul style="text-align: justify;">
<li>Dans une base de données de type <i><b>Postgres</b></i>, les champs de type "date" existent également, avec plusieurs formats d'enregistrement possibles : </li>
<ul><ul>
<li>format "<i><b>date</b></i>" : même chose que précédemment ;</li>
<li>format "<i><b>timestamp</b></i>" : à la fois la date et l'heure + minutes + secondes (avec ou sans prise en compte du fuseau horaire) ;</li>
<li>format "<i><b>time</b></i>" : uniquement heure+minutes+secondes, sans la date ;</li>
<li>format "<i><b>interval</b></i>" : uniquement intervalle entre deux dates. </li>
</ul>
</ul>
</ul>
<ul style="text-align: justify;">
<li>On ne peut pas modifier le formatage par défaut des champs "date", qui sont donc enregistrés 'à l'américaine' : <i>2017-07-14</i> ; en revanche, on peut modifier l'<u>affichage </u>de ces champs, et faciliter la saisie, en modifiant l'interface des formulaire de saisie dans QGIS : </li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvmYIXR9Axa5u5ZdjObgofqNEelrDgdolVeQGnfKCsbPTylgfra2tKOSyiyoXINQ60GMhXRJ27cfoveypER9TPYETM_RkosLzP0Z6dwp7LN0yLma9xpOEhCVJelEcbIVMsdEXVKG2P8E0B/s1600/type_saisie.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="223" data-original-width="584" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvmYIXR9Axa5u5ZdjObgofqNEelrDgdolVeQGnfKCsbPTylgfra2tKOSyiyoXINQ60GMhXRJ27cfoveypER9TPYETM_RkosLzP0Z6dwp7LN0yLma9xpOEhCVJelEcbIVMsdEXVKG2P8E0B/s1600/type_saisie.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: x-small;"><span style="background-color: #eeeeee;"><span style="color: #666666;"><i>Dans les propriétés de la couche, basculer de "Edition de texte" à "Date/heure"</i></span></span></span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCSMPVWntKwEILWcxaxQWN9YGPjWNPOa8Vit5XlkGMVD3mIFpH3BTIk6PI4GIP5QhKnTy8vBq-m3vbj81JO3T5H78ah2emssUyYNdlxEd7wEoLuNtzfBLiyYXcLGKMGyEjPxjT1HfnROR7/s1600/masque_saisie_date.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="325" data-original-width="594" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCSMPVWntKwEILWcxaxQWN9YGPjWNPOa8Vit5XlkGMVD3mIFpH3BTIk6PI4GIP5QhKnTy8vBq-m3vbj81JO3T5H78ah2emssUyYNdlxEd7wEoLuNtzfBLiyYXcLGKMGyEjPxjT1HfnROR7/s1600/masque_saisie_date.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: #eeeeee;"><span style="color: #666666;"><i>Puis définissez le masque personnalisé que vous souhaitez ...</i></span></span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXGM9fABXGUv65yaOiEV8fMYirEiQ192CbjqtV0Fh3_dK4Yun2epVIzOk0SujbAa7mvo1j74JiANbZqOpwnXCnXep4uir3OwqGWMMPPcreGGfKsxif5Tc-oj5twjyavNLTEa1OotMZY8WQ/s1600/saisie_date.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="264" data-original-width="500" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXGM9fABXGUv65yaOiEV8fMYirEiQ192CbjqtV0Fh3_dK4Yun2epVIzOk0SujbAa7mvo1j74JiANbZqOpwnXCnXep4uir3OwqGWMMPPcreGGfKsxif5Tc-oj5twjyavNLTEa1OotMZY8WQ/s1600/saisie_date.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: #eeeeee;"><span style="color: #666666;"><i>... au moment de la saisie, un calendrier apparaitra, et la date s'affichera au format voulu ...</i></span></span></td></tr>
</tbody></table>
<br />
<ul style="text-align: justify;">
</ul>
<div style="text-align: justify;">
Saisir des dates sera désormais un jeu d'enfant (et imaginez l'intérêt de cette interface si vous travaillez sur une tablette de terrain !). Voyons maintenant quelques cas d'usage que permettent ces enregistrements : </div>
<ul style="text-align: justify;">
<li><b><span style="color: #cc0000;">Les expressions de QGIS</span></b> permettent d'utiliser des fonctions spécifiques aux dates. Par exemple, on peut utiliser un calcul d'intervalle entre la date d'aujourd'hui et une date enregistrée. L'expression utilisera la fonction <i><b>age(date1, date2)</b></i> ainsi que la fonction <i><b>now() </b></i>qui correspond à l'instant présent de votre machine (année-mois-jour-heure-minute-seconde). Ainsi, l'expression ci-dessous renvoie l'intervalle entre 'maintenant' et la date enregistrée dans le champ <b><i>"date4"</i></b>, en nombre d'années :</li>
</ul>
<div style="text-align: center;">
<span style="color: #cc0000;"><b><i>year(age(now(), "date4"))</i></b></span></div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
Pour illustrer cet exemple, imaginons que vous êtes gestionnaire d'ouvrages (par exemple des ANC) avec une obligation de visite tous les 4 ans. Vous pourrez afficher sur la carte des points de couleur différente en fonction de l'ancienneté de la dernière visite (ici, rouge pour les ouvrages non visités depuis plus de 3 ans). </blockquote>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzZrIMeDLePoJHGkqg2LUnaqiem1jY6aL3SQ7EwYJF3mxTvlTGPDzfD4kJn86CPqiax3ISzeuAVjp5sxpWWTGhaObDEfJji6817n7-jQhvGCVhqHnKxWuUchGKPMuOycvtfQSYc8cxJ-l9/s1600/expression_age_year.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="249" data-original-width="609" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzZrIMeDLePoJHGkqg2LUnaqiem1jY6aL3SQ7EwYJF3mxTvlTGPDzfD4kJn86CPqiax3ISzeuAVjp5sxpWWTGhaObDEfJji6817n7-jQhvGCVhqHnKxWuUchGKPMuOycvtfQSYc8cxJ-l9/s1600/expression_age_year.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><i><span style="color: #666666;"><span style="background-color: #eeeeee;">Instruction pour un affichage couleur différent en fonction de l'intervalle de temps calculé</span></span></i></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrF2R47_pbP_EwsAo6cdUGms0SxGknPUP_CYk_WIG4wvPuaCbBWHtnUUrNlBBtfCWD2WR90VpnUdJRRrtZN9MbHXIWW6dxrib7i8H9kY45Sw3uTL2qh6_jf_-GEQFokkkkfW6dblmsfD9K/s1600/carte_visite_ouvrages.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="282" data-original-width="393" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrF2R47_pbP_EwsAo6cdUGms0SxGknPUP_CYk_WIG4wvPuaCbBWHtnUUrNlBBtfCWD2WR90VpnUdJRRrtZN9MbHXIWW6dxrib7i8H9kY45Sw3uTL2qh6_jf_-GEQFokkkkfW6dblmsfD9K/s1600/carte_visite_ouvrages.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<ul style="text-align: justify;">
<li style="text-align: justify;"><span style="color: #cc0000;"><span style="background-color: white;"><b>L'extension Time Manager</b> </span></span>permet de créer des cartes animées selon une dimension temporelle. La vidéo ci-dessous représente la localisation des structures dans lesquelles je suis intervenu depuis 2012. Une lente migration vers le Sud ...</li>
</ul>
<div style="text-align: justify;">
<div style="text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/-cwTLHuyYUQ/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/-cwTLHuyYUQ?feature=player_embedded" width="320"></iframe></div>
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<ul>
<li><span style="color: #cc0000;"><b>Utilisation dans un code python</b></span> : le langage Python* permet dans QGIS de créer des procédures automatisées, qui pourront se déclencher à diverses occasions (à l'ouverture ou à la fermeture d'un projet, ou bien lorsqu'un nouvel enregistrement est réalisé, ou bien à date fixe ...). Si l'on reprend notre exemple concernant le suivi des ouvrages, on peut imaginer une alerte qui fabrique automatiquement une liste des ouvrages à visiter de toute urgence, qui crée un document issue de cette liste, et qui l'envoi automatiquement par mail au chef de service concerné. </li>
</ul>
<span style="font-size: x-small;"><span style="color: #666666;"><i> * langage informatique très diffusé, et qui est utilisé dans QGIS pour la création des extensions et des fonctions personnalisées ...</i></span></span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHO363KYLcscWiASBcVI9va-U39MvwHexTBtEQ1AcuvSqQRb6wAjANqZFxKXI1knEk7fkqz61l9ONlYmTFgZBAsLQfMNUs5Fc6EeEg1V4pP5vKLVaPUPcxwomrm1xo9T4kx6LRJUTO7XUC/s1600/code_python.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="391" data-original-width="583" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHO363KYLcscWiASBcVI9va-U39MvwHexTBtEQ1AcuvSqQRb6wAjANqZFxKXI1knEk7fkqz61l9ONlYmTFgZBAsLQfMNUs5Fc6EeEg1V4pP5vKLVaPUPcxwomrm1xo9T4kx6LRJUTO7XUC/s1600/code_python.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: #eeeeee;">Première lignes d'un code python qui automatise un message d'alerte en fonction d'un intervalle de temps</span></td></tr>
</tbody></table>
</div>
<div style="text-align: justify;">
<br /></div>
<ul>
<li><b><span style="color: #cc0000;"><span style="font-size: large;"> En conclusion</span></span></b></li>
</ul>
<div style="text-align: justify;">
Un SIG est un outil puissant dont la finalité n'est pas uniquement "cartographique". Si on le considère de façon large, c'est un outil de gestion des données de différents types (spatiales, mais aussi temporelles, statistiques, picturales, carnet d'adresses, etc.), qui pourra être exploité de façon très souple comme outil de suivi, d'aide à la décision, d'illustration, d'analyse, de communication, de prospection ... </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Dans l'ensemble de ces usages possibles, la composante temporelle apporte une énorme plus-value, à condition de savoir la manipuler, et d'avoir correctement conçu l'architecture de votre base de données. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com0tag:blogger.com,1999:blog-5881852511371261263.post-1698794502951300442014-11-15T16:24:00.001-08:002014-11-15T16:26:13.700-08:00Sortie de QGIS 2.6 : échantillon de quelques nouveautés intéressantes<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Désormais, une <b>nouvelle version de QGIS</b> sort tous les 4 mois. A chaque sortie, de nouvelles fonctionnalités sont ajoutées et des bugs sont corrigés : il n'y a aucune raison de s'en priver (d'autant plus qu'on peut continuer à conserver en parallèle les anciennes versions). </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
A la suite, une sélection de quelques nouveautés qui me paraissent intéressantes :</div>
<ul style="text-align: justify;">
<li>Tout d'abord, une évolution majeure en terme de vitesse d'affichage des cartes : <b>la possibilité d'utiliser plusieurs processeurs</b> (le nombre dépendra de votre machine) ; vous constaterez que les affichages de cartes un peu lourdes se font beaucoup plus rapidement. </li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDK44yQ4zfPPIaOr9OYysF0_AjS9GtxPHcVo3-Di2ZYCcXDeTpnbSd_dEJYFfKcfOPF3jSSHeVGWyu-8cnX7c-2HYLZWoxw_ZmBAPoo9reKgVNuGouHRHSM6ISVEj-6Sqkb5U3ufyDLnNM/s1600/Multithreads.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDK44yQ4zfPPIaOr9OYysF0_AjS9GtxPHcVo3-Di2ZYCcXDeTpnbSd_dEJYFfKcfOPF3jSSHeVGWyu-8cnX7c-2HYLZWoxw_ZmBAPoo9reKgVNuGouHRHSM6ISVEj-6Sqkb5U3ufyDLnNM/s1600/Multithreads.jpg" /></a></div>
<br />
<ul>
<li style="text-align: justify;"> l'<b>Atlas </b>évolue encore dans le bon sens, puisqu'il permet maintenant d'insérer une image de façon dynamique en fonction de l’élément en cours d'édition. Par exemple, si vous sortez l'Atlas des mares de votre territoire, chaque page de l'Atlas pourra désormais inclure une image de la mare, pour peu que vous ayez au préalable défini un champ de type "<b>lienphoto</b>", dans lequel sera enregistré le chemin vers le fichier "<b><span style="color: blue;">mare_001.jpg</span></b>". </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEVBC628JO7dprnX8yW9OCxwRnVlbzPWp2HQXhexmNtmU12q1ifZFHD6fNVdC885IVIQwmxce7oXdFqBefOc7Ut-NxyVMbc_yNnVU_HuL8idiYMcYETvK3XA1ezcHI4XtZ1738LqlhJcQb/s1600/QGIS_Atlas_image.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEVBC628JO7dprnX8yW9OCxwRnVlbzPWp2HQXhexmNtmU12q1ifZFHD6fNVdC885IVIQwmxce7oXdFqBefOc7Ut-NxyVMbc_yNnVU_HuL8idiYMcYETvK3XA1ezcHI4XtZ1738LqlhJcQb/s1600/QGIS_Atlas_image.jpg" /></a></div>
<ul>
<li> Lorsque l'on réalise une <b>jointure d'une couche A à une couche B</b>, on peut désormais choisir les champs joints :</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6KHvxRyYww_YB6C90Y_HNkySVCRnFBj27jhOYabY6vM0DVUEXTlGJXQzEdFmikNu_hqxRU99lFRRLVDbyw6ZJe47AWZVeLcrG5wF3tHkb6ecXr66frkX4g2tWtU0SbuHelr5Yojzh1OKJ/s1600/QGIS_jointure.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6KHvxRyYww_YB6C90Y_HNkySVCRnFBj27jhOYabY6vM0DVUEXTlGJXQzEdFmikNu_hqxRU99lFRRLVDbyw6ZJe47AWZVeLcrG5wF3tHkb6ecXr66frkX4g2tWtU0SbuHelr5Yojzh1OKJ/s1600/QGIS_jointure.jpg" /></a></div>
<ul>
<li style="text-align: justify;">Il est désormais possible de créer un "<b>champ virtuel</b>" grâce à la calculatrice de champs ; celui-ci sera <b>dynamiquement </b>lié aux actions sur les objets de la carte (nouvel objet, remodelage, etc.) ; dans mon exemple ci-dessous, le champ "surf_ha" renverra la surface en hectare des objets de la couche "communes". Ce champs ne sera pas sauvegardé dans la couche elle-même, mais dans le projet. </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO78updU6O2PXtjgBmI97Mu2YGpbejwmtqjjUvr1RQnSiPcdZ9N41pwZ2FA95f4H1HrZiNp_JOO5Y3wbg_dAIVaYk87F6ckRHHwt7WSAi0LMpQFxTGuKD_x3vEEEWJkbqNbM-cUbvBeTpX/s1600/QGIS_champ_virtuel.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO78updU6O2PXtjgBmI97Mu2YGpbejwmtqjjUvr1RQnSiPcdZ9N41pwZ2FA95f4H1HrZiNp_JOO5Y3wbg_dAIVaYk87F6ckRHHwt7WSAi0LMpQFxTGuKD_x3vEEEWJkbqNbM-cUbvBeTpX/s1600/QGIS_champ_virtuel.jpg" /></a></div>
<ul style="text-align: justify;">
<li> <b> L'outil de choix des couleurs</b> est désormais très développé : il permet de construire des couleurs personnalisées de façon très intuitive, de créer ses propres palettes et des les enregistrer, ou bien d'en importer ... en outre, il permet d'afficher les codes html correspondants à chaque couleur, ce qui permet une réutilisation de ces couleurs dans d'autres applications par la suite. </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYOZBI7wzIFnND2Ed_fNWR1JvxVjoiA9vjzlCo-_TLMn8rHpjpPzPgDhCswk15fOSOUXxi7_cOfRJOqTSbfdCain5y6Uw9Z-YBZlQQoO-hWYskjLd4IOiB0y7JyJ7bHNG0Fhxdsob1VIw/s1600/QGIS_couleurs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYOZBI7wzIFnND2Ed_fNWR1JvxVjoiA9vjzlCo-_TLMn8rHpjpPzPgDhCswk15fOSOUXxi7_cOfRJOqTSbfdCain5y6Uw9Z-YBZlQQoO-hWYskjLd4IOiB0y7JyJ7bHNG0Fhxdsob1VIw/s1600/QGIS_couleurs.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWUpUi-hpmb9_OovTxTMGUPpxNFuSuwnG1B3-NO2QnDdrXFaloI7HNuhcQEk7VFKeFzGCUK5aVxhrnuvqtjfCHwsJ4XzMj6_pbyPA3tH64244ElXiz4v9M4AjmbVhwRqoa5SHUZ9koVpqT/s1600/QGIS_couleurs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<br />
<b><span style="color: #b45f06;"><u>Conclusion</u> :</span></b><br />
<br />
<div style="text-align: justify;">
La liste des nouveautés est encore longue, vous les découvrirez peu à peu ... QGIS évolue vite (et bien), et cela vaut vraiment la peine de se tenir à jour au fur et à mesure des nouvelles versions. Parallèlement à l'évolution du cœur du logiciel, de nombreuses extensions existent et de nouvelles apparaissent, grâce à l'activité intense des utilisateurs / programmeurs. Certaines me paraissent très intéressantes, et j'en parlerai dans mes prochains articles. </div>
<br />
<br />In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com0tag:blogger.com,1999:blog-5881852511371261263.post-20828444563948983742014-09-15T23:14:00.000-07:002014-09-16T04:48:55.925-07:00Comment gérer un grand nombre d'images de type "fond de carte" (idée de catalogue d'images) ? Les fonds de cartes de type photos aériennes sont livrés par jeux de dalles pour couvrir une zone donnée (par exemple, les orthophotos de l'IGN sont livrées par dalles de 5 x 5 km).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW8yYgUtevUMbu_ydMg4_IAST3IVKUa2SadFqjPyZr4rfDq3733hBi2OvxmKAATbEi_aPoxL9EzfFOBA0dF9psym0IkFOruNAUbZMcPjCujAu9BnJsy8v8sQK9MNFxRjxBEwKUvFh0gvw7/s1600/Dalles_orthophotos.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW8yYgUtevUMbu_ydMg4_IAST3IVKUa2SadFqjPyZr4rfDq3733hBi2OvxmKAATbEi_aPoxL9EzfFOBA0dF9psym0IkFOruNAUbZMcPjCujAu9BnJsy8v8sQK9MNFxRjxBEwKUvFh0gvw7/s1600/Dalles_orthophotos.jpg" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
Pour couvrir un secteur de 100 km par 100 km (imaginons par exemple un département de forme carré), il faudra donc 20 x 20 dalles, soit 400 dalles ... lourd à gérer, et lourd à charger. Il peut donc être intéressant de créer un outil qui permette <b>d'afficher / dés-afficher</b> chaque dalle par simple clic sur la zone choisie.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: #b45f06;"><b><u>1ère étape : l'affichage du jeu de dalles</u></b></span></div>
<div style="text-align: justify;">
<span style="font-size: x-small;"><i><span style="color: #b45f06;"><span style="color: #b45f06;">(étape facultative, mais ça permet de vérifier le bon affichage des images)</span> </span></i></span> </div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
L'exemple que je développe ci-dessous s'appuie sur des photos aériennes de la zone de l'agglomération de Brest, mises à disposition sur le site <a href="https://geo.pays-de-brest.fr/" target="_blank">Geo-Pays-De-Brest</a> ("Source : Brest métropole océane - 2010"). Pour les besoins de mon exemple, je me suis permis de redécouper ces images pour en faire un jeu de 35 dalles :</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEPta-XbjLf9tc9_nDSeusegi_3RhRpWI3HbF_Pw7vqW_Os1ktaQFUAvlFL_F-5SBi37dhivROJ7wxRsfrR2_H3auQaKJAiSgLsoat6ERO3Fteyr6vDjK-ZsVhI6UaPTeo7hH4dK4L7RyV/s1600/BrestOrtho.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEPta-XbjLf9tc9_nDSeusegi_3RhRpWI3HbF_Pw7vqW_Os1ktaQFUAvlFL_F-5SBi37dhivROJ7wxRsfrR2_H3auQaKJAiSgLsoat6ERO3Fteyr6vDjK-ZsVhI6UaPTeo7hH4dK4L7RyV/s1600/BrestOrtho.jpg" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b><span style="color: #b45f06;"><u>2ème étape : la création d'une grille des emprises de dalles</u></span></b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Il faut tout d'abord avoir installé l'extension "<b>Image Boundary</b>". La création de la grille se fait en 4 étapes :</div>
<ol style="text-align: justify;">
<li>ouverture du dossier dans lequel sont rangées les dalles (on veillera à ce qu'il ne contiennent <b><u>que</u></b> les dalles) ; </li>
<li>choix du format des images ; dans mon cas c'est de l'ECW. </li>
<li>on lance la recherche d'images ;</li>
<li>on lance la création d'une nouvelle couche shp, à laquelle on donnera par exemple le nom de "<span style="color: #3d85c6;">Decoupage.shp</span>" (et comme toujours on proscrit les accents dans les noms de dossiers et de fichiers). </li>
</ol>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6UJ1-yF-dzn0XQ7Mx2Ae2N5mEaovlcbbUkLkl-Yjb_RFpqNkUbziKadD__6UAWLzxpu_JN7J2w3eUFyA5PYV8XPzWjlEO13WjpAUxE6eBjII8yAxeIGSDqr5tt8fYPpHZjhD2tgl0i0XM/s1600/ImageBoundary.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6UJ1-yF-dzn0XQ7Mx2Ae2N5mEaovlcbbUkLkl-Yjb_RFpqNkUbziKadD__6UAWLzxpu_JN7J2w3eUFyA5PYV8XPzWjlEO13WjpAUxE6eBjII8yAxeIGSDqr5tt8fYPpHZjhD2tgl0i0XM/s1600/ImageBoundary.jpg" /></a></div>
<br />
<br />
Par défaut et ce n'est pas modifiable, la couche ainsi créée sera en projection WGS84 ; si votre SIG est calé en Lambert 93, vous devrez donc enregistrer la grille en modifiant sa projection et en la renommant. Dans mon cas, elle devient : "<span style="color: #3d85c6;">DecoupageL93.shp</span>". (1). Cette nouvelle couche comporte divers champs, dont le champ "<b>Image</b>" avec le nom de la dalle et son extension (2) et le champ "<b>Path</b>" avec le chemin du répertoire où se trouvent les dalles.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmFnCgV_jlCvbumHaU3wfblgNGrA1WeGAN1lh15mkvh52eac7db_2j1I-kym8I9yUsc33o__nravOYM1vAfERRvoDDvfgNOk3V6hImQXQqBLcoanwkO04EIyMCeYMwiUzAU2Mk2Mq8Zdfo/s1600/Grille.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmFnCgV_jlCvbumHaU3wfblgNGrA1WeGAN1lh15mkvh52eac7db_2j1I-kym8I9yUsc33o__nravOYM1vAfERRvoDDvfgNOk3V6hImQXQqBLcoanwkO04EIyMCeYMwiUzAU2Mk2Mq8Zdfo/s1600/Grille.jpg" /></a></div>
<br />
<br />
<b><u><span style="color: #e69138;">3ème étape : création du champ "location" (au sens 'emplacement' en anglais)</span></u></b><br />
<br />
Ce champ sera tout simplement la concaténation des champs "Path" et "Image", pour obtenir le chemin complet vers chaque dalle. <i>Rem : le terme "Path" est un terme 'réservé' du langage python, il vaut donc mieux éviter de l'utiliser dans un code python. </i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqwZDJVKbHwjX9BMMpEujSl-hN3NASRCnTx-QJ6tnv17k5nvNkch8LvXe6kVJCykLNOUiaMVpNzyTqSyAwZnwW3aIKltAKA7160_dCa8VwJFqrmmQVgvtlXTowr5dSo6fDC1uDMZUexeUj/s1600/Location.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqwZDJVKbHwjX9BMMpEujSl-hN3NASRCnTx-QJ6tnv17k5nvNkch8LvXe6kVJCykLNOUiaMVpNzyTqSyAwZnwW3aIKltAKA7160_dCa8VwJFqrmmQVgvtlXTowr5dSo6fDC1uDMZUexeUj/s1600/Location.jpg" /></a></div>
<br />
Attention à la syntaxe et notamment au doublement des ' <span style="color: #073763;"><b>\\</b></span> 'dans l'expression ...<br />
<br />
<span style="color: #e69138;"><b><u>4ème étape : création d'une "action" en code python pour la couche "DecoupageL93"</u></b></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVqLLHv9z34JeAoKpc71ejfLd9MR1gNHpySaayp2ML6PFAK5UX3RH3dDub0bcIn-0oHczTKXbngXsPGlTJ0jvZTjBgCnYSQxXZfwV8i2lFxcw6FxCETH7JoWSRDFj4x8jVss1z1E6xte6w/s1600/Action.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVqLLHv9z34JeAoKpc71ejfLd9MR1gNHpySaayp2ML6PFAK5UX3RH3dDub0bcIn-0oHczTKXbngXsPGlTJ0jvZTjBgCnYSQxXZfwV8i2lFxcw6FxCETH7JoWSRDFj4x8jVss1z1E6xte6w/s1600/Action.jpg" /></a></div>
<br />
<div style="text-align: justify;">
Le code est le suivant (où l'on retrouve l'appel au champ "location" précédemment créé) : </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">macouche = qgis.utils.iface.activeLayer()</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">import os</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">chemin='[% "location" %]'</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">nomCouche = str(os.path.splitext(os.path.split(chemin)[1])[0])</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">instRegistry = QgsMapLayerRegistry.instance()</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">couche = instRegistry.mapLayersByName(nomCouche)</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">if len(couche) > 0:</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;"> instRegistry.removeMapLayer(couche[0].id())</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
</div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">else:</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;"> qgis.utils.iface.addRasterLayer(chemin,nomCouche)</span></div>
<div style="text-align: justify;">
<span style="color: #3d85c6;">
</span>
</div>
<div style="margin: 0px; text-align: justify; text-indent: 0px;">
<span style="color: #3d85c6;">qgis.utils.iface.legendInterface().setCurrentLayer(macouche)</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
C'est une action de type 'Python' et qu'on peut appeler 'OpenCloseRaster' ; (ou bien 'OuvrirFermerImage' pour les francophones susceptibles). N'oubliez pas de définir l'action en cliquant sur "Ajouter l'action à la liste". </div>
<br />
<span style="color: #e69138;"><u><b>5ème étape : on teste </b></u></span><br />
<br />
En utilisant le bouton action de la couche DecoupageL93 : si tout a été correctement fait, on aura effectivement un affichage / désaffichage des dalles sur lesquelles on clique.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7dOWEakO3PKCjEqq_ewBabBIr8hyA87UY_vno-6OQ9464opHyoZ_Bl6-12cnjEIVOMjhXroPKFzJ8XvwQWTsvjpXvfvNVzI7OSnErSHr7WSEnQ4yIXdfc_aiRydS1ZYMaY0D4mG6-UGEP/s1600/test.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7dOWEakO3PKCjEqq_ewBabBIr8hyA87UY_vno-6OQ9464opHyoZ_Bl6-12cnjEIVOMjhXroPKFzJ8XvwQWTsvjpXvfvNVzI7OSnErSHr7WSEnQ4yIXdfc_aiRydS1ZYMaY0D4mG6-UGEP/s1600/test.jpg" /></a></div>
<br />
<br />
<span style="color: #e69138;"><b><u>Commentaires : </u></b></span><br />
<br />
<div style="text-align: justify;">
Ce petit tutoriel répond à plusieurs demandes d'anciens stagiaires de mes formations. Il est pertinent dans leur cas, puisqu'ils travaillent sur de très grands secteurs (échelle départementale ou régionale, par exemple), et qu'il est trop lent de charger l'ensemble des dalles de leurs fonds de carte (Photos, Scan25, etc.). Pour ceux qui travaillent sur des secteurs plus restreints, je conseillerai plutôt de créer des VRT (couche virtuelle permettant la gestion d'un jeu de dalles comme s'il ne s'agissait que d'une seule).<br />
<br />
D'autres pistes sont à explorer : </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
- fusion des dalles pour créer un tif unique, qui sera extrêmement lourd mais dont l'affichage pourra être grandement accéléré par la création de "pyramides" ;</div>
<div style="text-align: justify;">
- ou bien encore une solution mixte : créer plusieurs VRT (par exemple "<span style="color: #45818e;">departement_NordEst.vrt</span>", etc.) et utilisation de l'action opencloseRaster sur ces quelques VRT ...</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Bref, à chacun de voir en fonction de ses usages, de ses images et de son matériel. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Bon courage. </div>
<div style="text-align: justify;">
<br /></div>
<br />In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com0tag:blogger.com,1999:blog-5881852511371261263.post-62799633090995793642014-05-20T15:04:00.000-07:002014-05-20T15:04:04.964-07:00Géneration d'Atlas avec QGIS ou "comment automatiser l'édition d'un grand nombre de cartes" ...<div style="text-align: justify;">
C'est une tâche classique, et bien souvent fastidieuse : pour l'édition d'un document <i>(typiquement un rapport de fin d'année, un diagnostic de terrain, un programme de visites et d'entretien, etc.)</i>, on doit éditer un grand nombre de cartes <i>(typiquement une carte par commune, par tronçon, par ouvrage, etc.)</i> ... </div>
<div style="text-align: justify;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibZ9dZljE2jxvjJ9sOnSnyMMFNq3FO4fZdfORAO1BH4M8bchvze3gM7dm5aVkihZkyLEUiSEUsUiiJlaRyio9mMMKlx4YquG1SKoWfe6WTNfYlwWTXRiv_Q-vo4XMdtDoSaaELLsD5pjWf/s1600/BandeauAtlas.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Atlas tutoriel QGIS InSitu SIG" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibZ9dZljE2jxvjJ9sOnSnyMMFNq3FO4fZdfORAO1BH4M8bchvze3gM7dm5aVkihZkyLEUiSEUsUiiJlaRyio9mMMKlx4YquG1SKoWfe6WTNfYlwWTXRiv_Q-vo4XMdtDoSaaELLsD5pjWf/s1600/BandeauAtlas.jpg" height="43" title="Atlas QGIS InSitu SIG" width="400" /></a></div>
<br />
<br /></div>
<div style="text-align: justify;">
Depuis la version <b><i>2.0 - Dufour</i></b>, QGIS dispose d'un Générateur d'Atlas qui permet d'automatiser cette tâche. La version <i><b>2.2 - Valmiera</b></i> apporte encore quelques fonctionnalités supplémentaires. Pas d'hésitation à avoir : l'outil vous fera gagner un temps fou et vaut largement d'y consacrer quelques minutes d'apprentissage. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Avançons par étape ... </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: #783f04;"><span style="color: #660000;"><b><u>É<span style="font-family: inherit;">tape </span>n°1</u></b></span> </span>: on commence par la fin, c'est à dire qu'on se pose la question "que cherchai-je à faire ?" ; dans mon exemple, je veux éditer un inventaire des mares d'un territoire, avec localisation à différentes échelles, identification, données, et même photo de la mare.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeOQCq8pFWd8mB7F2JhxFP7rjoi4xR-er8NulKgiqLObEjwcxeA8OIhVMwdtIyVeFnJBvmvdmgHAOdDZV9MekpKzrgjMD0F2d6oREFeYoZs4wiWi_09hztI3vxBbuqhs3OhHi9O86vUZ5g/s1600/CanevasMEP.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeOQCq8pFWd8mB7F2JhxFP7rjoi4xR-er8NulKgiqLObEjwcxeA8OIhVMwdtIyVeFnJBvmvdmgHAOdDZV9MekpKzrgjMD0F2d6oREFeYoZs4wiWi_09hztI3vxBbuqhs3OhHi9O86vUZ5g/s1600/CanevasMEP.jpg" height="238" width="320" /></a></div>
</div>
<div style="text-align: justify;">
<b><u><span style="font-size: small;"><span style="color: #660000;">Étape n°2</span><span style="color: #0c343d;"><span style="color: #660000;"> </span>:</span><span style="color: #0c343d;"> </span></span> </u></b><br />
<br />
On ouvre dans QGIS l'ensemble des couches nécessaires (par exemple : mares ; communes ; rivière ; zones NATURA2000 ; photos aériennes ; etc.). Puis on soigne la présentation de chaque couche pour rendre la carte lisible et élégante (symbolisations, étiquettes, transparence des couches, couleurs catégorisées, seuils d'affichage, etc ...).<br />
<br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<i><u>Astuce </u>: dans notre future fenêtre de mise en page, nous aurons un cadre de carte à l'échelle 1/25 000ème (carte principale) et un autre cadre de carte à l'échelle 1/500 000ème (carte de localisation à échelle large). Il y a plusieurs méthodes pour insérer plusieurs cadre de carte dans une même mise en page, mais j'ai une nette préférence pour le plugin "<span style="background-color: #fff2cc;">Layer Combination</span>"</i> <i>: je n'explique pas ici son fonctionnement, du reste assez simple, mais vous pourrez toujours me questionner à ce sujet si vous bloquez. </i></blockquote>
</blockquote>
<br />
<span style="color: #660000;"><b><u>Étape n°3 :</u></b></span> <br />
<br />
Enfin, on ouvre une fenêtre de mise en page (<span style="background-color: #fff2cc;">Projet </span><b>=></b> <span style="background-color: #fff2cc;">nouveau composeur d'impression</span>). <br />
<ul>
<li>On commence par faire les choix de composition : taille et orientation du papier (A4 paysage dans mon cas), qualité de l'image en sortie (300 dpi par défaut), etc. </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg15cfjk7zQBtLDdJzNlmBwZXnLbCsPOt-kwrNcq0BelfZttLUGp10rO15AUSBdF9WKJ1fcpqKZiWREsToFu6RzxxDwv2GaL7Kc-UZ9wBQNwer24tJsmgjkUoQj1HGsodvrUZqNszjN8FEq/s1600/OngletComposition.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg15cfjk7zQBtLDdJzNlmBwZXnLbCsPOt-kwrNcq0BelfZttLUGp10rO15AUSBdF9WKJ1fcpqKZiWREsToFu6RzxxDwv2GaL7Kc-UZ9wBQNwer24tJsmgjkUoQj1HGsodvrUZqNszjN8FEq/s1600/OngletComposition.jpg" height="320" width="264" /></a></div>
<ul>
<li> Puis on définit les paramètres du générateur d'Atlas dans l'onglet du même nom : on choisit la couche qui servira de trame (dite "<span style="background-color: #fff2cc;">couche de couverture</span>") ; dans mon cas, c'est la couche <span style="background-color: #fff2cc;">MARES2</span>). J'ai aussi choisi de ne générer l'Atlas que pour les mares pour lesquelles nous disposons d'une photo (et donc le champ "lienphoto" n'est pas vide, c'est le sens du <i><span style="background-color: #fff2cc;">Filtrer avec : length("lienphoto") > 1</span></i>) ; enfin, chaque fichier généré portera un nom de type "<span style="background-color: #fff2cc;">AtlasMare2014_code_mare</span>", en faisant appel à la valeur du champs "<span style="background-color: #fff2cc;">code_mare</span>". </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJn3seZO0NNWksfoEQOoAZAuvW3kK1n6t1Go-6-yzjDe_z88q1-1dnZlYwH3MNWx2nTlXTXZC-PtqC55krYF3p92g7BgGUNRx1a63ctcF85YHeRLkdY7j-UtOLq4bBzAukaOs13pm6cmW5/s1600/OngletAtlas.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJn3seZO0NNWksfoEQOoAZAuvW3kK1n6t1Go-6-yzjDe_z88q1-1dnZlYwH3MNWx2nTlXTXZC-PtqC55krYF3p92g7BgGUNRx1a63ctcF85YHeRLkdY7j-UtOLq4bBzAukaOs13pm6cmW5/s1600/OngletAtlas.jpg" height="320" width="287" /></a></div>
<ul>
<li><u>Titre</u> : on ouvre un cadre de texte, et l'on y place par exemple
le texte suivant, qui fera appel au code de la mare en tant que variable
qui s'adaptera à chaque page de l'Atlas :</li>
</ul>
<div style="text-align: left;">
<blockquote class="tr_bq">
<span style="font-size: x-small;"><span style="background-color: #fff2cc;">ATLAS 2014 DES MARES DE LA DURDENT</span></span><br />
<div>
<span style="font-size: x-small;"><span style="background-color: #fff2cc;">
</span></span><span style="font-size: x-small;"><span style="background-color: #fff2cc;">MARE n° : [% "code_mare" %] </span></span></div>
</blockquote>
</div>
<ul>
<li> <u>Cartouche technique</u> (sources et copyright, date de mise à jour, réalisé par ...). Si on veut que la date de mise à jour s'inscrive automatiquement, on peut utiliser la formule suivante : </li>
</ul>
<blockquote class="tr_bq">
<div style="text-align: left;">
<span style="font-size: x-small;"><span style="background-color: #fff2cc;">Mise à jour le : [% day( $now ) || '/' || month( $now ) || '/' || year( $now )%]</span></span></div>
</blockquote>
<ul>
<li> <u>Photo de la mare</u> : nous allons utiliser la possibilité d'insérer du code html (et donc la possibilité d'insérer une image) en faisant appel à un champ "<span style="background-color: #fff2cc;">lienphoto</span>" qu'il faut avoir auparavant créé et renseigné avec le chemin vers les photos correspondant à chaque mare ... le code à copier et à adapter à votre cas est le suivant : </li>
</ul>
<blockquote class="tr_bq">
<div style="text-align: left;">
<span style="font-size: x-small;"><span style="background-color: #fff2cc;"><img src="file:///[% "lienphoto" %]" </span></span><span style="font-size: x-small;"><span style="background-color: #fff2cc;">style="width: auto; height: 100%; display: block; margin: 0px 0px 0px auto;" /></span></span></div>
</blockquote>
<br /><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUKbS8AAJEVCMkgKlLqWoavaF4EdD0DffOi6t4ppDSyzeKak8_P8CiW54JQhZqUnVBZHsW3EPpr9hzUoSk6idwcxUGRAOIOpMGmDTqCt9OsGIEB2A7zmrE6BRFR6_cVe7HN4qrJnA5bnsx/s1600/AtlasInsererImg.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUKbS8AAJEVCMkgKlLqWoavaF4EdD0DffOi6t4ppDSyzeKak8_P8CiW54JQhZqUnVBZHsW3EPpr9hzUoSk6idwcxUGRAOIOpMGmDTqCt9OsGIEB2A7zmrE6BRFR6_cVe7HN4qrJnA5bnsx/s1600/AtlasInsererImg.jpg" height="321" width="400" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<span style="color: #660000;"><b><u>Étape n°4 :</u></b></span> <br />
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
Nous y voilà : tout est prêt pour lancer l'Atlas ; avant de lancer le générateur (cela peut être long en fonction du nombre d'images à générer et du poids des couches affichées) on peut pré-visualiser les résultats du traitement avec la barre d'outil suivante :</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpkYk1gEPGSzWpDS26Y1xPEOK2MO3Ml1U4XUfRmnjM_7P96ZDJZnliWVf5bkMP-UEMlxPSt3rhR9ycGF4vA_ola9tx9YVHq9yq-y_3PN_9ivbXT180WYILZAoHDpq1c-8wPoeqvll8KOLJ/s1600/AtlasPreview.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpkYk1gEPGSzWpDS26Y1xPEOK2MO3Ml1U4XUfRmnjM_7P96ZDJZnliWVf5bkMP-UEMlxPSt3rhR9ycGF4vA_ola9tx9YVHq9yq-y_3PN_9ivbXT180WYILZAoHDpq1c-8wPoeqvll8KOLJ/s1600/AtlasPreview.jpg" height="50" width="200" /></a></div>
<br />
Et c'est parti ...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqk_2JZUd6-9sWP6giT-XKGIFcWtxFppPC6WKQkFiRuKkg910uyXEUO6C90dy_sXd3rZE4W9I78BKsb6yu7QYlDa3xringcqn7mpw0WrcieoaWGWDr0KxEXRPkU7_e-QYaoKVugHllCr3w/s1600/AtlasLancement.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqk_2JZUd6-9sWP6giT-XKGIFcWtxFppPC6WKQkFiRuKkg910uyXEUO6C90dy_sXd3rZE4W9I78BKsb6yu7QYlDa3xringcqn7mpw0WrcieoaWGWDr0KxEXRPkU7_e-QYaoKVugHllCr3w/s1600/AtlasLancement.jpg" height="90" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ8gD8CQGWD-MoZqqCLbpw0jhgbLeKIAEnGhYiVZOrv2wKW7UC9azHLdI1GPVmalQXzkklHvyS4B78TKPdgiqCWdAHxpvoLR86RNbGFZ_QcqFv8dHkztjkZx2UTyfRfbnVPQl5wRFcUyOj/s1600/AtlasResultat.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ8gD8CQGWD-MoZqqCLbpw0jhgbLeKIAEnGhYiVZOrv2wKW7UC9azHLdI1GPVmalQXzkklHvyS4B78TKPdgiqCWdAHxpvoLR86RNbGFZ_QcqFv8dHkztjkZx2UTyfRfbnVPQl5wRFcUyOj/s1600/AtlasResultat.jpg" height="196" width="320" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #660000;"><b><u>Bonus :</u></b></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
Pour faire apparaitre l'objet concerné par la page de l'Atlas en cours de création dans un style différent des autres objets, on peut utiliser la fonction <span style="background-color: #fff2cc;">$atlasfeatureid</span> dans la définition du style de la couche MARES : </div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT1baXEDfK0_2GFm5A1xQsJlOd_HB8A3f0Mmf7DJDse3WjE3ND8hTKetPYhtU2fZy9KltK_0fcU-VQ9HvfqguKYo4Puqlrp6A979wLEM9N7uVIn60RMSLHDCfHJ0PMbTroj9SX-4S83iSr/s1600/AtlasFeatureID.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT1baXEDfK0_2GFm5A1xQsJlOd_HB8A3f0Mmf7DJDse3WjE3ND8hTKetPYhtU2fZy9KltK_0fcU-VQ9HvfqguKYo4Puqlrp6A979wLEM9N7uVIn60RMSLHDCfHJ0PMbTroj9SX-4S83iSr/s1600/AtlasFeatureID.jpg" height="245" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
Ce qui donne le résultat suivant : </div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiypMv4mbw3I4ViCYNkNgZs3EPLodJZDiDfyhHCy5sP0d57Dvt6h8jX4mHCObjOmhiXzllgqkX2vtOzy8izrxX7bJ6ZLmX2qiF-n_eyhg0WmXQ1gYodUUWM0rua8UTC7p3wstUd8i_du4Xu/s1600/AtlasZoom.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiypMv4mbw3I4ViCYNkNgZs3EPLodJZDiDfyhHCy5sP0d57Dvt6h8jX4mHCObjOmhiXzllgqkX2vtOzy8izrxX7bJ6ZLmX2qiF-n_eyhg0WmXQ1gYodUUWM0rua8UTC7p3wstUd8i_du4Xu/s1600/AtlasZoom.jpg" height="278" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #660000;"><b><u>Conclusion :</u></b></span> </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
L'outil est vraiment utile et bien fait, même s'il nécessite de très bien se concentrer lors des premières utilisations ... pour l'anecdote et pour illustrer la façon dont progresse le logiciel, il s'agissait à la base d'une extension (développée par la société <a href="http://oslandia.com/" target="_blank">Oslandia</a>), qui a été introduite dans les fonctions intégrées du logiciel au moment du passage à la version 2.0 ; merci à eux, et bon usage à tous. </div>
</div>
<div style="text-align: justify;">
</div>
In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com4tag:blogger.com,1999:blog-5881852511371261263.post-87146285209058950142014-03-26T01:54:00.003-07:002014-09-15T23:45:11.658-07:00Quelques astuces pour se simplifier QGIS<b><span style="color: #274e13;"><u>QGIS 2.2 "Valmiera"</u></span></b><br />
<b><span style="color: #274e13;"><br /></span></b>
<br />
<div style="text-align: justify;">
<span style="color: #444444;">Pour commencer, saluons la sortie de la dernière version de QGIS ; la version 2.1 vous a échappé ... ? C'est normal : désormais, le cycle de développement de QGIS suivra la logique suivante :</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: #444444;">- numéros impairs (2.1 ; 2.3 : etc.) pour les versions en cours de développement. Chacun peut la télécharger pour assouvir sa curiosité, mais il s'agit de versions encore "en travaux", donc potentiellement instables ;</span></div>
<div style="text-align: justify;">
<span style="color: #444444;">- numéros pairs, avec un nom propre associé (Dufour, Valmiera ...) pour les sorties officielles. A noter qu'il y a toujours quelques bugs à la sortie, rapidement corrigés, il est donc raisonnable d'attendre quelques semaines avant de télécharger la nouvelle version. </span></div>
<div style="text-align: justify;">
<span style="color: #444444;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #444444;">La version "Valmeira" propose des nouveautés principalement du côté du composeur d'impression, et notamment du générateur d'Atlas ... j'en parlerai éventuellement dans un futur post. </span></div>
<div style="text-align: justify;">
<span style="color: #444444;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #444444;">Enfin, ne vous privez pas pour tester cette nouvelle version : elle peut être installée en parallèle des autres versions, sans conflit. </span></div>
<span style="color: #274e13;"></span><b><span style="color: #274e13;"></span></b><br />
<br />
<b><span style="color: #274e13;"><u>Astuce n° 1 : jointure et nommage automatique des champs joints</u></span></b><br />
<br />
<div style="text-align: justify;">
Lorsque l'on réalise une jointure d'une table (<span style="color: #990000;"><b><u>"densite_pop_49"</u></b></span> dans mon exemple) avec une couche (<span style="color: #990000;"><b>"49-Maine-et-Loire"</b></span> dans mon exemple), les champs joints prennent automatiquement un nom de la forme <b><span style="color: #990000;">"nom_de_la_table_jointe_nom_du_champ"</span></b> ... ce qui n'est ni très élegant ni très pertinent, car si l'on souhaite enregistrer cette jointure en tant que nouvelle couche au format <i>.shp</i>, les noms de champs seront tronqués à 10 caractères. </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL4JDrC9bPbuv2humacB8kqvPsIgsShVUlmGsbomIyy2qIZ_1tZLmm3XD9b1lMrK2v5eMVI5wXPRZzbyIS5YHBvhSQXrKqovlm_UlDhwm1WBhNJOaOA2FosrLNDPGgwy9-uh1O3e0KHQzT/s1600/jointure_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL4JDrC9bPbuv2humacB8kqvPsIgsShVUlmGsbomIyy2qIZ_1tZLmm3XD9b1lMrK2v5eMVI5wXPRZzbyIS5YHBvhSQXrKqovlm_UlDhwm1WBhNJOaOA2FosrLNDPGgwy9-uh1O3e0KHQzT/s1600/jointure_1.jpg" height="174" width="320" /></a></div>
<br />
<div style="text-align: justify;">
L'astuce consiste à modifier le nom attribué à la table utilisée dans la jointure, en utilisant le menu "Général" de la fenêtre "Propriétés de la couche" ; l'idéal est de lui attribuer le nom le plus simple, l'underscore ou tiret-bas : "<span style="color: #990000;"><b>_</b></span>" ;</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOQDMQr_Qqgn7lRJbA77UIDrjuTtTk9zfjPLEEAmUqJSmottM9pGkPUVKH1KgQtullhNcZ7xiH18aLxvpyHk5W0AtD7dpOYlem0CPnorn6ehLKHJj-klyrjG5LEdf6MqhEOn7ZnFj9FMgw/s1600/jointure_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOQDMQr_Qqgn7lRJbA77UIDrjuTtTk9zfjPLEEAmUqJSmottM9pGkPUVKH1KgQtullhNcZ7xiH18aLxvpyHk5W0AtD7dpOYlem0CPnorn6ehLKHJj-klyrjG5LEdf6MqhEOn7ZnFj9FMgw/s1600/jointure_2.jpg" height="96" width="320" /></a></div>
<br />
Dès lors on pourra refaire la jointure et les champs porteront des noms plus sobres :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUr_lO209F3qRRZK9QECwXrMvOPLxfLA2BK5q-Fq0E4RpN0ioVbAzz_hMPiH62zShh6u3sEX3ECn0WfftN7KJLnZRKGd-91uOS-ZqAmVFbp3wd83QgnFjEUWgdHAMv-BpUJW50p7fwx9z/s1600/jointure_4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUr_lO209F3qRRZK9QECwXrMvOPLxfLA2BK5q-Fq0E4RpN0ioVbAzz_hMPiH62zShh6u3sEX3ECn0WfftN7KJLnZRKGd-91uOS-ZqAmVFbp3wd83QgnFjEUWgdHAMv-BpUJW50p7fwx9z/s1600/jointure_4.jpg" height="223" width="320" /></a></div>
<br />
<div style="text-align: justify;">
Dans mon exemple, la couche des contours des communes provient d'Open Street Map, et les données sur la densité de population du site de l'INSEE. La jointure m'a permis d'aboutir à la carte suivante :</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiru44lcG8j85ET7HEMuu4PsjDj7vVVgwGkbLzUZHK3OEa5JBesxjX4rph2yR6TbjEmSQcS_EQzhutj_xbkTRKGnMILSvBgGjpGfiSHcM52UBTBUh7PP14dZHjcQN9OQFf195dG2AzHld0s/s1600/jointure_5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiru44lcG8j85ET7HEMuu4PsjDj7vVVgwGkbLzUZHK3OEa5JBesxjX4rph2yR6TbjEmSQcS_EQzhutj_xbkTRKGnMILSvBgGjpGfiSHcM52UBTBUh7PP14dZHjcQN9OQFf195dG2AzHld0s/s1600/jointure_5.jpg" height="181" width="320" /></a></div>
<br />
<br />
<b><span style="color: #274e13;"><u>Astuce n° 2 : affichage des objets en cours d'édition</u></span></b><br />
<br />
<div style="text-align: justify;">
Par défaut, lorsque vous passez une couche en mode éditable, chaque point apparait sous la forme d'une croix rouge, et pour l'ensemble des objets de la couche ... pas forcément très beau ni très lisible ...</div>
<br />
<div style="text-align: center;">
<span style="font-size: x-small;"><i>Régions métropolitaines - source : OpenStreetMap.</i></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixTBoDLizv4s_Lq4RYmUBnIDZKpx7FisViff6dIABJ7fBp63nZhDo54uGRdhfpp4_q4yY1YivrgKNiRXoXTW4kQSrY9FbHQQsy6uLeC9da25NL_HRbXnOrli-CQCzKNkspW3TVTVGsN_d5/s1600/PointsObjetsSelectionn%C3%A9s.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixTBoDLizv4s_Lq4RYmUBnIDZKpx7FisViff6dIABJ7fBp63nZhDo54uGRdhfpp4_q4yY1YivrgKNiRXoXTW4kQSrY9FbHQQsy6uLeC9da25NL_HRbXnOrli-CQCzKNkspW3TVTVGsN_d5/s1600/PointsObjetsSelectionn%C3%A9s.jpg" height="296" width="320" /></a></div>
<br />
<div style="text-align: justify;">
Ce comportement peut être modifié dans le menu "Préférences" => "Options" => "Numérisation"=> "Symbole de sommet". Personnellement, je préfère le symbole "cercle semi-transparent", de taille 3, et je coche "montrer les symboles uniquement pour les entités sélectionnées". C'est plus léger à l'affichage. </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeHd-ElwA1uxtTpBanjeyC4yWHjy-HchEAmbxpIE32ewwJU0pKauxNTbk7FOGo2g6gw1EeIUYrW5hff5fzarHd-E0Dwe0UAIQnj9g7IRL2sanf85jXS_cdSwepm7SWuQFkD3cWpxnVI8HT/s1600/StyleNumerisation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeHd-ElwA1uxtTpBanjeyC4yWHjy-HchEAmbxpIE32ewwJU0pKauxNTbk7FOGo2g6gw1EeIUYrW5hff5fzarHd-E0Dwe0UAIQnj9g7IRL2sanf85jXS_cdSwepm7SWuQFkD3cWpxnVI8HT/s1600/StyleNumerisation.jpg" height="202" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqNWLH3S5hdJnijkxx9Vt0RimSwKkOl-CbAjYd2ZtKigZmQlABqVB5gRBbio9wI3xlYYdRtgMLRoK1AryWRXsYa5yQ-guc7jvIa0_q2t82OhDdu7Ayzw6tgdZQ8O_ZHjgmEf1qodZs3_Ut/s1600/Fleche.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqNWLH3S5hdJnijkxx9Vt0RimSwKkOl-CbAjYd2ZtKigZmQlABqVB5gRBbio9wI3xlYYdRtgMLRoK1AryWRXsYa5yQ-guc7jvIa0_q2t82OhDdu7Ayzw6tgdZQ8O_ZHjgmEf1qodZs3_Ut/s1600/Fleche.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq6h0pj8M6VI7RYzzELD1Tp7IH12EMLtvHPuwIQxEcwda7k-Hfo1ElPd54jJneERH-Cl47fzzkNzZ1ieLWo35NCodV6QUXctl01UHy66vJ6rFcwtHNn5CIa3NR5SweDUtiDahIaKP2OF_2/s1600/PointsObjetsSelectionnes2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq6h0pj8M6VI7RYzzELD1Tp7IH12EMLtvHPuwIQxEcwda7k-Hfo1ElPd54jJneERH-Cl47fzzkNzZ1ieLWo35NCodV6QUXctl01UHy66vJ6rFcwtHNn5CIa3NR5SweDUtiDahIaKP2OF_2/s1600/PointsObjetsSelectionnes2.jpg" height="297" width="320" /></a></div>
<br />
<br />
<br />In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com0tag:blogger.com,1999:blog-5881852511371261263.post-5995364951874464442014-02-06T17:00:00.000-08:002014-03-06T09:00:59.835-08:00Géocodage en série (batch geocoding) avec QGIS<div style="text-align: justify;">
Avoir un fichier d'adresses, et le transformer en couche de points géolocalisés, de façon semi-automatique ... vous en avez peut être rêvé ; QGIS l'a fait ! </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Ci-dessous la liste puis la carte des organismes que j'ai eus en formation ; et plus bas, les explications pour arriver à ce résultat, en quelques clics.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN8LR2zni4GcMr15ZgETN0IZL-fltCM8rpdRyEIcQlGAT_UIWIWu9yuNfke9IOS6rCZATfm2QYSIcORoeRt8sr4YqWl4AobsVZixUhy_n0Tqb2QxDMYo3lX8eo6vMOMZXEN2DZmSi4fbtP/s1600/Geocode_CSV.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN8LR2zni4GcMr15ZgETN0IZL-fltCM8rpdRyEIcQlGAT_UIWIWu9yuNfke9IOS6rCZATfm2QYSIcORoeRt8sr4YqWl4AobsVZixUhy_n0Tqb2QxDMYo3lX8eo6vMOMZXEN2DZmSi4fbtP/s1600/Geocode_CSV.jpg" /></a></div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD9t3mgXuFb74G9NiH2CrBKV2fh5PS8YWXgahG0_6_fQqR9MvVBh-CHeYB716NH9boGapMpxOteqp7TEvhHbT3O3kOPa1q9nj9kfX1qZLPl4YwCoqogGrT15SwOz6iuEVYcIUMcibDsIIX/s1600/Fleche.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD9t3mgXuFb74G9NiH2CrBKV2fh5PS8YWXgahG0_6_fQqR9MvVBh-CHeYB716NH9boGapMpxOteqp7TEvhHbT3O3kOPa1q9nj9kfX1qZLPl4YwCoqogGrT15SwOz6iuEVYcIUMcibDsIIX/s1600/Fleche.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRYVoiqTxuyhSA59tazgX_3AHAppWK439DLSlvDWqRJscEppORt5lZrM_S1s2gMy-1aROs88-X8ABRl8VzEcKnPEb__o6XAL3BKdvcryWFEhRpQ3XnOvm-V0fXYn1Lq5GSVSGidV63FkMx/s1600/Geocode_CarteFinale.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRYVoiqTxuyhSA59tazgX_3AHAppWK439DLSlvDWqRJscEppORt5lZrM_S1s2gMy-1aROs88-X8ABRl8VzEcKnPEb__o6XAL3BKdvcryWFEhRpQ3XnOvm-V0fXYn1Lq5GSVSGidV63FkMx/s1600/Geocode_CarteFinale.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT112fYpqqs7H7niYLUAA4FrBIFgit8rE7M1xyY5JHYRmyVwcuhyphenhyphencvq-dMwLnCHndDF06CN940GmCo86yqeZlUjoKjlebiAwDb713RHH3oOSzLpDzBZx2-4T4FwOpQ8ntNeUZnhE3VU_qE/s1600/Geocode_CarteFinale.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<br />
<u><span style="color: #38761d;"><b>Étape 1 : Le fichier d'adresses</b></span></u><br />
<br />
<div style="text-align: justify;">
a) Créez, à partir de votre fichier d'adresses (par exemple un fichier Excel), un fichier de type <span style="color: #cc0000;"><b>".csv"</b></span>. Dans mon cas je l'ai fait à partir du logiciel OpenOffice ; </div>
<div style="text-align: justify;">
b) "nettoyez" le fichier original, pour ne garder que les lignes et colonnes nécessaires à la localisation des points : dans mon cas, les colonnes conservées sont "ORGANISME" ; "ADRESSE" ; "CP_VILLE" ; "PAYS". Préciser le pays évite de se retrouver avec des points en Louisiane ou au Québec, puisque nombre de ville françaises ont leurs homonymes là-bas !</div>
<div style="text-align: justify;">
c) "enregistrez sous" au format <span style="color: #cc0000;"><b>.csv</b></span> (<b>impérativement en <span style="color: #cc0000;">UTF-8</span></b>) ; pour cette raison, il faut proscrire les caractères spéciaux et les accents. </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcT1Z22V5W2W1lPNs9JGtrHI_Iz5WUfRnuKbTyNpSh4PTyqbxX4gOjwtc7WjsJPXNa0aL3b-LPfJ7lUgGje5BYgB3M5L8-4lADVrokhJn2rJ_4FCzNZhZOTXioFbbWZ_1GbeQj0j_DDcUJ/s1600/Encodage.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcT1Z22V5W2W1lPNs9JGtrHI_Iz5WUfRnuKbTyNpSh4PTyqbxX4gOjwtc7WjsJPXNa0aL3b-LPfJ7lUgGje5BYgB3M5L8-4lADVrokhJn2rJ_4FCzNZhZOTXioFbbWZ_1GbeQj0j_DDcUJ/s1600/Encodage.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #38761d;"><b><u>Etape 2 : Extension "MMQGIS"</u></b></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
- Installez et activez l'extension "<span style="color: #cc0000;"><b>MMQGIS</b></span>", qui permet le "géocodage en série" (l'extension interroge en fait les bases d'adresses de Google Map ou de Open Street Map). Il propose d'autres outils intéressants mais ce n'est pas le sujet ici. </div>
<div class="separator" style="clear: both; text-align: justify;">
- ouvrez l'outil "<span style="color: #cc0000;"><b>Geocode</b></span>" dans le menu déroulant MMQGIS et inspirez vous de la fenêtre ci-dessous pour renseigner les différents champs :</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL92ONf7GKmeQ8LZkZoQ_6U3KHenJPO2ZR8s1ULXtbodsQhb_kIK54-AptRpozXtRb3IFF9nP3-Jixaw9KeXWNpRjku9vObqyo0SPXxldjqMVnCwjRJTPwo6314ruu2q-SkGsGZS8t5g1D/s1600/Geocode_Dialog.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL92ONf7GKmeQ8LZkZoQ_6U3KHenJPO2ZR8s1ULXtbodsQhb_kIK54-AptRpozXtRb3IFF9nP3-Jixaw9KeXWNpRjku9vObqyo0SPXxldjqMVnCwjRJTPwo6314ruu2q-SkGsGZS8t5g1D/s1600/Geocode_Dialog.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
- les adresses correctement localisées seront enregistrées sous forme d'une couche <b><span style="color: #cc0000;">shp</span></b>, dans le système de coordonnées de référence 4326 (c'est le <b><span style="color: #cc0000;">WGS84</span></b>, qu'utilisent notamment les GPS). </div>
<div class="separator" style="clear: both; text-align: justify;">
- les adresses non localisées seront stockées dans un fichier <b><span style="color: #cc0000;">notfound.csv</span></b></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #38761d;"><b><u>Étape 3 : utilisez la couche créée par géocodage dans votre propre SIG</u></b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
-Il faudra penser à enregistrer cette nouvelle couche dans votre SCR habituel (le <b><span style="color: #cc0000;">Lambert93</span></b>, normalement). </div>
<div style="text-align: justify;">
- dans mon exemple, le fond utilisé est celui d'OpenStreetMap, auquel on accède très simplement à l'aide de l'extension "<b><span style="color: #cc0000;">OpenLayerPlugin</span></b>". </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: #38761d;"><u><b>Conclusions </b></u></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
- l'outil exige quelques tâtonnements, mais une fois bien compris les principes généraux, quelle magie !</div>
<div style="text-align: justify;">
- il faut bien entendu que les adresses dont on dispose soient les plus complètes et précises possible, et il faut qu'il s'agisse d'adresses physiques (pas de BP 132 ...) ; </div>
<div style="text-align: justify;">
- j'ai fait l'essai avec Google et avec OSM : résultat, 51 adresses sur 52 trouvées par Google, alors que OSM n'en trouve que 14 ... avantage pour Google, à la date de rédaction de ce tuto, mais OSM progresse très vite ... </div>
<div style="text-align: justify;">
- et puis conclusion plus personnelle : cap au Sud !</div>
<br />In Situ SIGhttp://www.blogger.com/profile/11407319464402565632noreply@blogger.com0