<div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div>Hi Hannes, </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p>could you make the groovy part write a file or to a database that
      you have your students load as layer in QGIS and which will
      refresh from its source automatically on map canvas interaction?
      That might be a hacky but sufficient solution if I understand your
      goal correctly. If you write to a WKT file for example and load
      that in QGIS in watch mode, QGIS will automatically notice chances
      and refresh it without any interaction necessary (at least on
      Linux)!</p></div></blockquote><div>that is actually something I have not thought of. Nice idea, I will investigate it.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
    Otherwise it is very well be possible to implement a "pipe" into
    QGIS / API for QGIS using various techniques (maybe even expose
    iface and some nasty "exec"ing :D ). E. g. check out
    <a href="https://github.com/gem/oq-irmt-qgis/tree/qgis3-socketserver" target="_blank">https://github.com/gem/oq-irmt-qgis/tree/qgis3-socketserver</a> which
    uses websockets.</div></blockquote><div><br></div><div>That is actually very cool. But I have no QGIS plugin development skills, so that won't probably be an option for me.</div><div><br></div><div>Thanks a lot,</div><div>Andrea</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
    <p>Cheers, Hannes<br>
    </p>
    <p><br>
    </p>
    <div>Am 10.09.21 um 14:38 schrieb andrea
      antonello:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Hi Richard,</div>
        <div><br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> I guess you mean
            QGIS Desktop, right? AFAIK the only option is to use its
            Python API, which requires all the PyQGIS <<a href="https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/index.html" rel="noreferrer" target="_blank">https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/index.html</a>>
            and binary libs to be available inside the environment.<br>
            <br>
            Just curious: but would it be possible to 'attach' your
            script to a running/visible instance of QGIS?<br>
            <br>
            From: <a href="https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications" rel="noreferrer" target="_blank">https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications</a><br>
            <br>
            So: I start QGIS, and then from some python console (NOT the
            internal one), I can try to load (and show!) a shapefile in
            current mapcanvas? Or pan/zoom? That would be cool for
            demonstrations...<br>
          </blockquote>
          <div><br>
          </div>
          <div>I have to apologize and give a little context. I teach
            geographic scripting at a local university. Students come
            from the previous geomatics course with Arc. </div>
          <div>Since I have no intention to teach Arc scripting, I have
            been doing it for several years now happily using a
            scripting environment based on Geoscript Groovy [1].</div>
          <div>So we are talking about a completely different
            programming language. </div>
          <div>In the last year I have been able to pull some of them
            over to QGIS, but the traction is low. So I was hoping to be
            able to attach to some APi to load results into a running
            QGIS instance. That would be really cool, surely
            convince them and I would have been able to develop the
            geoscript part necessary to my environment.</div>
          <div><br>
          </div>
          <div>In the meanwhile I read Gio's comment: "Another option
            could be run a "micro server" inside a pyqgis plugin and
            serve an ad-hoc API from it :)"</div>
          <div><br>
          </div>
          <div>Yes, that would have been my dream :-) </div>
          <div><br>
          </div>
          <div>Thanks for your comments.</div>
          <div><br>
          </div>
          <div>Andrea</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>[1] <a href="https://jericks.github.io/geoscript-groovy-cookbook" target="_blank">https://jericks.github.io/geoscript-groovy-cookbook</a></div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <br>
            Regards,<br>
            <br>
            Richard Duivenvoorde<br>
            <br>
            <br>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
QGIS-Developer mailing list
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Johannes Kröger / GIS-Entwickler/-Berater
WhereGroup GmbH
Eifelstraße 7
53119 Bonn
Germany

Fon: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

<a href="mailto:johannes.kroeger@wheregroup.com" target="_blank">johannes.kroeger@wheregroup.com</a>
<a href="http://www.wheregroup.com" target="_blank">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm 
Amtsgericht Bonn, HRB 9885
-------------------------------

---------------------------------------------
 Aufwind durch Wissen!
 Jetzt neu: Web-Seminare und Online-Schulungen
 bei der <a href="http://www.foss-academy.com" target="_blank">www.foss-academy.com</a>
---------------------------------------------
</pre>
  </div>

</blockquote></div></div>
</div>