[Qgis-user] creating a python plugin to autopopulate some of the Georeferencer properties

Eric Goddard egoddard1010 at gmail.com
Tue Mar 29 09:18:26 PDT 2016


Problem solved, triggering from the raster menu didn't work, but going
through the raster toolbar did work.

for action in iface.rasterToolBar().actions():
    if action.objectName() == 'mActionRunGeoref':
        georef = action

georef.trigger()

On Mon, Mar 28, 2016 at 12:36 PM, Eric Goddard <egoddard1010 at gmail.com> wrote:
> Thanks Nathan, looking forward to 2.16 :)
>
> In the meantime I'm working on a plugin similar to the ArkPlan
> georeferencer (using the GeorefGraphicsView from ArkPlan) , but I'm
> going to temporarily use the hacky solution until I can get that
> finished, which brings me to my next question:
>
> If I I iterate over iface.rasterMenu().actions() and print each item's
> objectName, the only ones that show up are
> mActionShowRasterCalculator, mActionShowAlignRasterTool, and settings;
> the rest are empty strings. If I print each item's text, I get the
> menu text for each submenu on the rasterMenu, so the Georeferencer
> shows up as "&Georeferencer". How do I access the actions on the
> submenus within the rasterMenu()?
>
> Just out of curiosity I did the same iteration over
> iface.rasterMenu().children(), which lists only one QMenu object
> (Terrain Analysis).
>
> Thanks for all of the feedback!
> Eric
>
> On Sat, Mar 26, 2016 at 8:50 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
>> Don't stress. I'm going to move it to core in 2.16. Will let you know once
>> it's done.
>>
>> - Nathan
>>
>>
>> On Sat, 26 Mar 2016 11:21 pm John Layt <jlayt at kde.org> wrote:
>>>
>>> On 26 March 2016 at 00:03, Eric Goddard <egoddard1010 at gmail.com> wrote:
>>> > Awesome, thanks John. We have about the same number of images to georef
>>> > so
>>> > that will be a big help. I looked at the georeferencer code which is how
>>> > I
>>> > discovered that some of the properties were stored in QSettings. I'm not
>>> > too
>>> > familiar with c++ though, but since the qgis api can be used to do
>>> > custom
>>> > applications I was hoping for a constructor for the georeferencer that I
>>> > could use.
>>>
>>> I did look at forking the C++ georeferencer and adapting it, or
>>> perhaps creating my own python bindings using SIP, but the thought of
>>> having to maintain and install compiled versions for all three
>>> platforms just seemed more hassle, even though I am a C++ developer.
>>>
>>> Trying to think of hacky ways to do this you could trigger the
>>> mActionRunGeoref QAction via QgisInterface.rasterMenu().actions(), but
>>> that would only open the georeferencer, it wouldn't get you having the
>>> right file preselected, there simply isn't an api or setting to do
>>> that. I guess it would allow you to have a plugin that when clicked on
>>> presets the settings you need (including directory) before launching
>>> the georeferencer.
>>>
>>> The ideal would be to move a lot of the code into the public api with
>>> python bindings and have a processing plugin so it can be python
>>> scriptable, but I just don't have the time to do that. One day the
>>> poor usability will get too much though and I will fix it...
>>>
>>> John.
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list