[Qgis-developer] Use Georeferencer Core-Plugin with python

Matthias Kuhn matthias.kuhn at gmx.ch
Mon May 19 12:09:41 PDT 2014


A pull request is online for review:

https://github.com/qgis/QGIS/pull/1370

Please post your comments there if you are interested in this 
functionality.

On Mon 19 Mai 2014 18:55:54 CEST, G. Allegri wrote:
> Of course Matthias is right if you want to interface with a plugin
> instance running inside QGIS. That's why I said you could bind only
> the inner logic of the Georeferencer to use it "outside" the plugin
> instance. In case you need to control, or get work done from, the
> Georeferencer plugin itself you have to do what Matthias is doing in
> its commit.
>
> giovanni
>
>
> 2014-05-19 18:33 GMT+02:00 Matthias Kuhn <matthias.kuhn at gmx.ch
> <mailto:matthias.kuhn at gmx.ch>>:
>
>     The python modules gui and core are exported and the "iface"
>     variable (QgisInterface) knows about their presence. But
>     QgisInterface should not have any dependencies on plugin code,
>     therefore it's harder to access this code.
>     It may not be hard if you only make use of code which you use in a
>     standalone library way (maybe that would already be enough for
>     your case). If you want to get access to a running plugin instance
>     this is a different story. You can have a look at the code in [1]
>     for an example of how this might be accomplished. Although the
>     code seems not to be working, I've got to check what's still
>     missing there, but in principle the ideas in commit [1] should work.
>
>     Best,
>     Matthias
>
>     [1]
>     https://github.com/m-kuhn/__QGIS/commit/__571b4fa7e6afcefb9c4911339db2c4__b7689ce6a9
>     <https://github.com/m-kuhn/QGIS/commit/571b4fa7e6afcefb9c4911339db2c4b7689ce6a9>
>
>
>
>     On Mon 19 May 2014 05:34:41 PM CEST, Felix Schmidt wrote:
>
>         @Matthias: what do you mean with:
>         Am 19.05.2014 16:41, schrieb Matthias Kuhn: "the code is not
>         exported
>         to the gui or core libraries/sip modules"?
>
>             It will not be so easy to just write wrappers because the
>             code is not
>             exported to the gui or core libraries/sip modules.
>             I have written code that makes it possible to generate python
>             bindings for (C++) plugins and I'm considering creating a
>             pull-request for it.
>
>             Matthias
>
>
>             On 05/19/2014 04:33 PM, G. Allegri wrote:
>
>                 It depends on what parts of the Georeferencer you
>                 need. If you don't
>                 need the GUI but only the math, you could consider
>                 writing a SIP
>                 wrapper around QgsGeorefTransformInterface
>                 implementations [1].
>                 Otherwise, if Python performance would suffice, you
>                 could grab the
>                 low level math from QgsGeorefTransform and
>                 QgsLeastSquares [2] and
>                 translate it to Python.
>
>                 giovanni
>
>                 [1]
>                 https://github.com/qgis/QGIS/__blob/master/src/plugins/__georeferencer/__qgsgeoreftransform.cpp
>                 <https://github.com/qgis/QGIS/blob/master/src/plugins/georeferencer/qgsgeoreftransform.cpp>
>                 [2]
>                 https://github.com/qgis/QGIS/__blob/master/src/plugins/__georeferencer/qgsleastsquares.__cpp
>                 <https://github.com/qgis/QGIS/blob/master/src/plugins/georeferencer/qgsleastsquares.cpp>
>
>
>
>                 2014-05-19 16:32 GMT+02:00 G. Allegri
>                 <giohappy at gmail.com <mailto:giohappy at gmail.com>
>                 <mailto:giohappy at gmail.com <mailto:giohappy at gmail.com>>>:
>
>
>                     It depends on what parts of the Georeferencer you
>                 need. If you
>                     don't need the GUI but only the math, you could
>                 consider writing
>                     a SIP wrapper around QgsGeorefTransformInterface
>                 implementations
>                     [1].
>                     Otherwise, if Python performance would suffice,
>                 you could grab
>                     the low level math from QgsGeorefTransform and
>                 QgsLeastSquares
>                     [2] and translate it to Python.
>
>                     giovanni
>
>                     [1]
>
>                 https://github.com/qgis/QGIS/__blob/master/src/plugins/__georeferencer/__qgsgeoreftransform.cpp
>                 <https://github.com/qgis/QGIS/blob/master/src/plugins/georeferencer/qgsgeoreftransform.cpp>
>                     [2]
>
>                 https://github.com/qgis/QGIS/__blob/master/src/plugins/__georeferencer/qgsleastsquares.__cpp
>                 <https://github.com/qgis/QGIS/blob/master/src/plugins/georeferencer/qgsleastsquares.cpp>
>
>
>                     2014-05-19 16:10 GMT+02:00 Felix Schmidt
>                     <felix.schmidt at uni-weimar.de
>                 <mailto:felix.schmidt at uni-weimar.de>
>                 <mailto:felix.schmidt at uni-__weimar.de
>                 <mailto:felix.schmidt at uni-weimar.de>>>:
>
>
>                         Hello Giovanni,
>                         thanks for your answer. Do you think it is
>                 easier to write
>                         the Plugin for the historical border
>                 extraction in c++
>                         instead of python, cause of the binding
>                 implementation?
>
>                         Felix
>
>                         Am 19.05.2014 14:52, schrieb G. Allegri:
>
>                             Hi Felix,
>                             I fear you will have to write your own
>                 bindings if you
>                             want to leavarage the Georeferencer plugin
>                 code. It's a
>                             plugin, so it's functionality isn't
>                 exposed through QGIS
>                             API.
>
>
>
>
>
>                     --
>                     Giovanni Allegri
>                     http://about.me/__giovanniallegri
>                 <http://about.me/giovanniallegri>
>                     Twitter: https://twitter.com/_giohappy_
>                     blog: http://blog.spaziogis.it
>                     GEO+ geomatica in Italia http://bit.ly/GEOplus
>
>
>
>
>                 --
>                 Giovanni Allegri
>                 http://about.me/__giovanniallegri
>                 <http://about.me/giovanniallegri>
>                 Twitter: https://twitter.com/_giohappy_
>                 blog: http://blog.spaziogis.it
>                 GEO+ geomatica in Italia http://bit.ly/GEOplus
>
>
>                 _________________________________________________
>                 Qgis-developer mailing list
>                 Qgis-developer at lists.osgeo.org
>                 <mailto:Qgis-developer at lists.osgeo.org>
>                 http://lists.osgeo.org/__mailman/listinfo/qgis-__developer
>                 <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>
>
>
>     _________________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>     http://lists.osgeo.org/__mailman/listinfo/qgis-__developer
>     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> Twitter: https://twitter.com/_giohappy_
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus




More information about the Qgis-developer mailing list