<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi Folks</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I am trying to update a 2.x snippet I have which iteratively sets the CRS with sequentially higher LO values:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><a href="https://gist.github.com/timlinux/1057c2c6b5ebda6ed2b5aa8c5aa21372">https://gist.github.com/timlinux/1057c2c6b5ebda6ed2b5aa8c5aa21372</a></font><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC2" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC3" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># Uses a trick from Alexander Neto: "I created a orthographic projection with lisbon longitude, but with a south hemisphere latitude</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC4" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># That way kinda looks 3d"</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC5" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC6" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># This will make the QGIS use a world projection and then move the center</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC7" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># of the CRS sequentially to create a spinning globe effect</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC8" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-k">import</span> <span class="gmail-pl-s1">time</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC9" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-k">from</span> <span class="gmail-pl-s1">subprocess</span> <span class="gmail-pl-k">import</span> <span class="gmail-pl-s1">call</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC10" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-s1">longitude_increments</span> <span class="gmail-pl-c1">=</span> <span class="gmail-pl-c1">5</span> </td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC11" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-s1">image_counter</span> <span class="gmail-pl-c1">=</span> <span class="gmail-pl-c1">1</span> </td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC12" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-k">for</span> <span class="gmail-pl-s1">i</span> <span class="gmail-pl-c1">in</span> <span class="gmail-pl-en">range</span>(<span class="gmail-pl-c1">-</span><span class="gmail-pl-c1">180</span>, <span class="gmail-pl-c1">180</span>, <span class="gmail-pl-s1">longitude_increments</span>):</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC13" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">definition</span> <span class="gmail-pl-c1">=</span> ( </td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC14" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">      <span class="gmail-pl-s">'+proj=ortho +lat_0=-20 +lon_0=%i +x_0=0 +y_0=0 +R=6371000 +units=m +no_defs +type=crs'</span> <span class="gmail-pl-c1">%</span> <span class="gmail-pl-s1">i</span>)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC15" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">crs</span> <span class="gmail-pl-c1">=</span> <span class="gmail-pl-v">QgsCoordinateReferenceSystem</span>()</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC16" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">crs</span>.<span class="gmail-pl-en">createFromProj</span>(<span class="gmail-pl-s1">definition</span>)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC17" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">iface</span>.<span class="gmail-pl-en">mapCanvas</span>().<span class="gmail-pl-en">mapSettings</span>().<span class="gmail-pl-en">setDestinationCrs</span>(<span class="gmail-pl-s1">crs</span>)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC18" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-c">#iface.mapCanvas().setMapUnits(0)</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC19" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">iface</span>.<span class="gmail-pl-en">mapCanvas</span>().<span class="gmail-pl-en">refresh</span>()</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC20" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">iface</span>.<span class="gmail-pl-en">mapCanvas</span>().<span class="gmail-pl-en">saveAsImage</span>(</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC21" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">        <span class="gmail-pl-s">'/tmp/globe-%03d.png'</span> <span class="gmail-pl-c1">%</span> <span class="gmail-pl-s1">image_counter</span>)                                                                     </td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC22" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">image_counter</span> <span class="gmail-pl-c1">+=</span> <span class="gmail-pl-c1">1</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC23" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-en">print</span> (<span class="gmail-pl-s1">definition</span>)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC24" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">    <span class="gmail-pl-s1">time</span>.<span class="gmail-pl-en">sleep</span>(<span class="gmail-pl-c1">1</span>)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC25" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC26" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># Now generate the GIF. If this fails try run the call from the command line</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-file-spinning_globe_orthographc-py-LC27" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"># and check the path to convert (provided by ImageMagick) is correct...</span></td>
      </tr>
      <tr>
        </tr></tbody></table><span class="gmail-pl-en">call</span>(<span class="gmail-pl-s">'/usr/bin/convert -delay 35 -loop 0 /tmp/globe-*.png /tmp/globe.gif'</span>)<font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">The  example python above using Orthographc North will hopefully make a more pleasing looking spinny globe. However, i</font><span style="font-family:arial,helvetica,sans-serif">n QGIS 3.x the code runs but if I inspect the </span>mapcanvas<span style="font-family:arial,helvetica,sans-serif"> CRS after setting the new CRS, it still shows the old CRS. Can anyone see what I am missing here?</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Thanks!</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Regards</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Tim</font></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="text-align:center">------------------------------------------------------------------------------------------</div><div style="text-align:center"><div style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif;font-size:small;display:inline"></div><img src="https://mail.google.com/mail/u/0/?ui=2&ik=7ebbf93252&view=fimg&th=15a9e43c0bbf93ca&attid=0.1&disp=emb&realattid=9436e64174762963_0.1.1&attbid=ANGjdJ-WL_J24nvBiYidJ0V0xpdsYqRwswi5nq5oywcJEHC7twYVMrxG0y-GNPu_ahJthV8ktXwYuHoVm5DI2FrRAtPzelTRHrsE2wweR9uu8wT-zz2hNRqFwi4SorQ&sz=s0-l75-ft&ats=1488721675176&rm=15a9e43c0bbf93ca&atsh=1" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;"><br></div><div style="text-align:center">Tim Sutton</div><div style="text-align:center"><span style="text-align:start">Visit </span><a href="http://kartoza.com/" style="text-align:start" target="_blank">http://kartoza.com</a><span style="text-align:start"> to find out about open source:</span><br style="text-align:start"><span style="text-align:start"> * Desktop GIS programming services</span><br style="text-align:start"><span style="text-align:start"> * Geospatial web development</span></div><div style="text-align:center"><span style="text-align:start">* GIS Training</span></div><div style="text-align:center"><span style="text-align:start">* Consulting Services</span></div><div style="text-align:center"><div style="text-align:center"></div><div style="text-align:start"><div style="text-align:center">Tim is a member of the QGIS Project Steering Committee</div><div style="text-align:center">-------------------------------------------------------------------------------------------</div></div></div></div></div></div></div></div></div></div>