﻿{"id":5815,"date":"2018-07-30T03:08:05","date_gmt":"2018-07-30T01:08:05","guid":{"rendered":"http:\/\/www.sigterritoires.fr\/?p=5815"},"modified":"2018-10-17T12:59:16","modified_gmt":"2018-10-17T10:59:16","slug":"qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/","title":{"rendered":"QGis 2.8 graphic modeller: Python script Iteration, nesting and export"},"content":{"rendered":"<p><strong>The execution<\/strong> <strong>of<\/strong> <strong>model<\/strong> <strong>algorithms<\/strong> <strong>by<\/strong> <strong>iteration<\/strong><\/p>\n<p>In the previous chapter we have executed our model that selects and cuts those plots located within 500 meters of our oyster facilities. The result is a single layer of plots. But we could want to recover the plots of each facility in a different layer. We have nine facilities; therefore we would like to have s nine layers.<br \/>\nIn the first case, if a plot is located within 500 m of two or more facilities it appears just once. \u00a0In the second case we would have this plot in as many layers as facilities are located within 500 m from it.<\/p>\n<p>With the QGis graphic modeller, this task is extremely simple.<!--more--><\/p>\n<p>Remember the structure of our model:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5817\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it1.png?fit=630%2C396&amp;ssl=1\" data-orig-size=\"630,396\" 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=\"it1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it1.png?fit=630%2C396&amp;ssl=1\" class=\"alignnone size-medium wp-image-5817\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it1-300x189.png?resize=300%2C189\" alt=\"\" width=\"300\" height=\"189\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it1.png?resize=300%2C189&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it1.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>A first algorithm calculates the 500m buffer zone around \u00a0 <strong><em>installations<\/em><\/strong> and a second algorithm cuts the <strong><em>plots<\/em><\/strong> layer with the buffer zones produced by the first.<\/p>\n<p>Therefore we would like this model to run as many times as facilities are present in the Installations layer .<\/p>\n<p>We must only launch the model and indicate that we wish the iteration in the <strong><em>Installations<\/em><\/strong> layer.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5818\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it2.png?fit=595%2C442&amp;ssl=1\" data-orig-size=\"595,442\" 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=\"it2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it2.png?fit=595%2C442&amp;ssl=1\" class=\"alignnone size-medium wp-image-5818\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it2-300x223.png?resize=300%2C223\" alt=\"\" width=\"300\" height=\"223\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it2.png?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it2.png?w=595&amp;ssl=1 595w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>The symbol located next to the input layers enables to run this task. Just click to activate Iteration on the layer concerned.<br \/>\nBe careful not to get the wrong entry layer. In our example we have 9 Facilities and 863 plots. \u00a0If you make a mistake and ask iteration on the plots you will get 863 layers in the output!<\/p>\n<p>As with any model, you can leave the name of the output layer empty to create temporary layers, or enter a path and file name to create permanent layers. The only thing that changes with iteration is that temporary or permanent names will be completed with a digital index indicating the correspondent iteration number iteration:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5819\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it3.png?fit=406%2C218&amp;ssl=1\" data-orig-size=\"406,218\" 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=\"it3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it3.png?fit=406%2C218&amp;ssl=1\" class=\"alignnone size-medium wp-image-5819\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it3-300x161.png?resize=300%2C161\" alt=\"\" width=\"300\" height=\"161\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it3.png?resize=300%2C161&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it3.png?w=406&amp;ssl=1 406w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>In this example we have entered <strong><em>C: \\ QGis \\ data articles \\<\/em><\/strong> <strong><em>results<\/em><\/strong> <strong><em>\\<\/em><\/strong> <strong><em>result<\/em><\/strong> as name of the exit layer. We have got nine layers named <strong><em>result_0.shp<\/em><\/strong> to <strong><em>result_8.shp<\/em><\/strong> .<\/p>\n<p><strong>Nesting<\/strong> <strong>models<\/strong><\/p>\n<p>As we have stated above, when a model is checked in the models folder, it appears in the treatment tools category Panel Models Box. What has not been mentioned above is that it appears also in the algorithms tab of the graphic modeller window. This means that one model previously written can be used as an algorithm in another model.<\/p>\n<p>But you have to be careful since a model may not appear in the algorithms list if some of their components are not available. It may occur if an algorithm provider is disabled. For example, if you have in use a SAGA tool in a model but you have subsequently disabled the SAGA tools, this model will not be available. As long as all the algorithms of a model are present in the panel of the treatment toolbox, the model will be available whenever an algorithm in the graphic modeller.<\/p>\n<p>To illustrate this feature, we will rely on the model we have used in the previous section. Once the parcels are created and the land areas located within 500 m we will merge the Maritime District results. This information is included in the attribute table of the parcels and therefore in the attribute table of the outcome layer.<\/p>\n<p>We start by naming the new model and assigning the same group<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5820\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it4\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it4.png?fit=630%2C188&amp;ssl=1\" data-orig-size=\"630,188\" 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=\"it4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it4.png?fit=630%2C188&amp;ssl=1\" class=\"alignnone size-medium wp-image-5820\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it4-300x90.png?resize=300%2C90\" alt=\"\" width=\"300\" height=\"90\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it4.png?resize=300%2C90&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it4.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>We add the input data: plots and facilities<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5821\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it5\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it5.png?fit=630%2C251&amp;ssl=1\" data-orig-size=\"630,251\" 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=\"it5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it5.png?fit=630%2C251&amp;ssl=1\" class=\"alignnone size-medium wp-image-5821\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it5-300x120.png?resize=300%2C120\" alt=\"\" width=\"300\" height=\"120\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it5.png?resize=300%2C120&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it5.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>We add the existing model<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5822\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it6\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it6.png?fit=630%2C422&amp;ssl=1\" data-orig-size=\"630,422\" 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=\"it6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it6.png?fit=630%2C422&amp;ssl=1\" class=\"alignnone size-medium wp-image-5822\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it6-300x201.png?resize=300%2C201\" alt=\"\" width=\"300\" height=\"201\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it6.png?resize=300%2C201&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it6.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>1- We select the algorithms tab<br \/>\n2- Click-and-move the riparian model plots<br \/>\n3- We complete the input fields<\/p>\n<p>Then we click OK<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5823\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it7\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it7.png?fit=540%2C226&amp;ssl=1\" data-orig-size=\"540,226\" 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=\"it7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it7.png?fit=540%2C226&amp;ssl=1\" class=\"alignnone size-medium wp-image-5823\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it7-300x126.png?resize=300%2C126\" alt=\"\" width=\"300\" height=\"126\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it7.png?resize=300%2C126&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it7.png?w=540&amp;ssl=1 540w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Now we will add the algorithm for merging polygons following the content of a field (dissolved)<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5824\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it8.png?fit=630%2C456&amp;ssl=1\" data-orig-size=\"630,456\" 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=\"it8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it8.png?fit=630%2C456&amp;ssl=1\" class=\"alignnone size-medium wp-image-5824\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it8-300x217.png?resize=300%2C217\" alt=\"\" width=\"300\" height=\"217\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it8.png?resize=300%2C217&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it8.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>For the input layer select <em>&lsquo;<\/em> <em>riparian plots<\/em> <em>&lsquo;<\/em> <em>created<\/em> <em>by<\/em> <em>the algorithm<\/em> <em>&lsquo;riparian<\/em> <em>plots<\/em> <em>&lsquo;<\/em><br \/>\nIn <strong><em>Dissolve<\/em><\/strong> <strong><em>everything<\/em><\/strong> select <strong>NO<\/strong> since we want to use the contents of a field like as merger criterion<br \/>\nIn <strong><em>Unique<\/em><\/strong> <strong><em>identification Field<\/em><\/strong> we enter the field name containing the criterion (NEIGHBORHOOD)<br \/>\nWe give a name to the outcome layer (riparianzone)<br \/>\nWe do not need to define the parent algorithm since we use the output of the previous algorithm.<br \/>\nWe click <strong>OK<\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5825\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it9\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it9.png?fit=630%2C461&amp;ssl=1\" data-orig-size=\"630,461\" 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=\"it9\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it9.png?fit=630%2C461&amp;ssl=1\" class=\"alignnone size-medium wp-image-5825\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it9-300x220.png?resize=300%2C220\" alt=\"\" width=\"300\" height=\"220\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it9.png?resize=300%2C220&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it9.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Now the full model is as follows :<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5826\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it10\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it10.png?fit=557%2C411&amp;ssl=1\" data-orig-size=\"557,411\" 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=\"it10\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it10.png?fit=557%2C411&amp;ssl=1\" class=\"alignnone size-medium wp-image-5826\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it10-300x221.png?resize=300%2C221\" alt=\"\" width=\"300\" height=\"221\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it10.png?resize=300%2C221&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it10.png?w=557&amp;ssl=1 557w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Once registered, the new model is ready to be used. It appears in the section Models of treatment tools Box<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5827\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it11\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it11.png?fit=630%2C334&amp;ssl=1\" data-orig-size=\"630,334\" 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=\"it11\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it11.png?fit=630%2C334&amp;ssl=1\" class=\"alignnone size-medium wp-image-5827\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it11-300x159.png?resize=300%2C159\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it11.png?resize=300%2C159&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it11.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Double-click to execute it.<br \/>\nWe inform the dialogue window<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5828\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it12\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it12.png?fit=591%2C364&amp;ssl=1\" data-orig-size=\"591,364\" 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=\"it12\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it12.png?fit=591%2C364&amp;ssl=1\" class=\"alignnone size-medium wp-image-5828\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it12-300x185.png?resize=300%2C185\" alt=\"\" width=\"300\" height=\"185\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it12.png?resize=300%2C185&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it12.png?w=591&amp;ssl=1 591w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>The result appears. If we open the attribute table of the outcome layer, we see that there is only one single polygon; all plots concerned corresponding to the same maritime district.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5829\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it13\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it13.png?fit=630%2C308&amp;ssl=1\" data-orig-size=\"630,308\" 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=\"it13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it13.png?fit=630%2C308&amp;ssl=1\" class=\"alignnone size-medium wp-image-5829\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it13-300x147.png?resize=300%2C147\" alt=\"\" width=\"300\" height=\"147\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it13.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it13.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><strong>Using<\/strong> <strong>batch<\/strong> <strong>processing<\/strong> <strong>with<\/strong> <strong>the models<\/strong><\/p>\n<p>The models can also be launched in batch mode just like the other processing algorithms. To do this , simply find the model in the panel of the treatment toolbox, right-click it and select perform as batch processing, as shown in the following screenshot:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5830\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it14\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it14.png?fit=285%2C167&amp;ssl=1\" data-orig-size=\"285,167\" 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=\"it14\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it14.png?fit=285%2C167&amp;ssl=1\" class=\"alignnone size-full wp-image-5830\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it14.png?resize=285%2C167\" alt=\"\" width=\"285\" height=\"167\" \/><\/p>\n<p>The tool works as other geoalgorithme in QGIS.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5831\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-2-8-graphic-modeller-python-script-iteration-nesting-and-export\/it15\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it15.png?fit=594%2C442&amp;ssl=1\" data-orig-size=\"594,442\" 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=\"it15\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it15.png?fit=594%2C442&amp;ssl=1\" class=\"alignnone size-medium wp-image-5831\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it15-300x223.png?resize=300%2C223\" alt=\"\" width=\"300\" height=\"223\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it15.png?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/it15.png?w=594&amp;ssl=1 594w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>You can click on Add lines, delete lines and finally RUN when you are ready. With this method, the model can be used on data sets from different geographical areas. This technique is also useful in those cases where you will repeat the geoprocessing steps many times on a collection of files.<\/p>\n<p><strong>How to convert<\/strong> <strong>a<\/strong> <strong>model<\/strong> <strong>in<\/strong> <strong>a Python script<\/strong><\/p>\n<p>In the QGIS version 2.4 it was possible to transform a processing model to a Python script. For that, it was enough to right click on the model in the processing Toolbox and select the option Record as a Python script. During the development of QGIS 2.6, the underlying code graphic modeller has been completely rewritten. Therefore, there are many changes and improvements in the files modeller new version. Model files are henceforth stored in JSON format instead of XML; there is no depth limit for nesting the models; we can drag and paste the algorithms and inputs to the graphic window of the modeler ; &#8230;<br \/>\nUnfortunately , the possibility to export a model like a Python script has not been implemented in the modeller updated.<br \/>\nThis feature should reappear in a future version of QGIS. For the moment, given the fact that the models are algorithms, they can always be executed from the Python Console.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The execution of model algorithms by iteration In the previous chapter we have executed our model that selects and cuts those plots located within 500 meters of our oyster facilities. The result is a single layer&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_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1260],"tags":[],"class_list":["post-5815","post","type-post","status-publish","format-standard","hentry","category-non-classe-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-1vN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/5815","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=5815"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/5815\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=5815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=5815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=5815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}