[Qgis-user] Help reusing QGIS action

Bernhard Ströbl bernhard.stroebl at jena.de
Tue Jun 2 22:38:24 PDT 2015


hi Brent,

the action is saved in the qml, too (not independently from style, though)

elaborating the Python-plugin thought you can create an action for the 
active layer like that:
layer = self.iface.activeLayer()
layer.actions().addAction(1, #actionType 1 = Python action
     "show species", <Python code>)

if you put that into a slot connected to a menu or button you are set. 
Users can create this action for any of their layers (won't make sense 
for all of them, I am sure but that's the user's responibility)

Bernhard

Am 02.06.2015 um 22:12 schrieb Brent Wood:
> Cheers Bernhard,
> Yes, I can do that, but creating the action for each layer is the repetitive task I want to simplify. Instead of typing the the command line for the action, I could just select & apply. This is less of an issue for me as for the users less familiar with QGIS that I'm working with.
>
> Like I can create a symbology once, then save it & apply it to new layers, I'd prefer not to have to create the action for every layer - instead I could create it once then save & reuse as appropriate.
> As an institutional resource, I can create a set of QGIS styles (symbologies) that users can copy & apply to layers, without having t go through the complex operation of creating it themselves. It would be great to be able to do the same thing with actions - create a library of actions for institutional WFS services that users can re-use - which is where your suggestion of Python is a good one - being platform independent.
>
> Thanks,
>    Brent
>
>        From: Bernhard Ströbl <bernhard.stroebl at jena.de>
>   To: qgis-user at lists.osgeo.org
>   Sent: Tuesday, June 2, 2015 5:36 PM
>   Subject: Re: [Qgis-user] Help reusing QGIS action
>
> Hi Brent,
>
> I hope I got the intention of what you want to achieve....
> Talking about layer actions you could define the same action for each of
> your layers calling the batch script and passing the point's id. Or you
> could create a Python action (functionality provided by a plugin) that
> lists all species for each point. This would be platform independent, too.
>
> Bernhard
>
> Am 02.06.2015 um 01:06 schrieb Brent Wood:
>> Hi,
>> I can create an action on a biodatabase: the site data is shown on the map, and an action created that will retrieve and dispaly a sorted list of the species identified at that site. This works well, as a bash script for Linux or a batch file for Windows.
>> What I'd like to be able to do is save an action, much like a style, to be applied to multiple layers.
>> The use case is: open a layer filtered to show species a, then other layers for species b & c. I then want to see the full list of species caught from individual stations, by clicking on the map. Currently I need to create the action separately for each species - when I have hundreds of species, this gets very cumbersome - so storing & re-using the action would be useful, just as I can reuse a style for each species layer with catch size based symbology.
>> Is there a way to do this now that I don't know? Do I need to file a ticket for this?
>> Any suggestions appreciated!
>> Thanks
>> Brent Wood
>>
>>
>>
>> __________ Information from ESET Mail Security, version of virus signature database 11719 (20150601) __________
>>
>> The message was checked by ESET Mail Security.
>> http://www.eset.com
>>
>>
>>
>> Hi,
>>
>> I can create an action on a biodatabase: the site data is shown on the
>> map, and an action created that will retrieve and dispaly a sorted list
>> of the species identified at that site. This works well, as a bash
>> script for Linux or a batch file for Windows.
>>
>> What I'd like to be able to do is save an action, much like a style, to
>> be applied to multiple layers.
>>
>> The use case is: open a layer filtered to show species a, then other
>> layers for species b & c. I then want to see the full list of species
>> caught from individual stations, by clicking on the map. Currently I
>> need to create the action separately for each species - when I have
>> hundreds of species, this gets very cumbersome - so storing & re-using
>> the action would be useful, just as I can reuse a style for each species
>> layer with catch size based symbology.
>>
>> Is there a way to do this now that I don't know? Do I need to file a
>> ticket for this?
>>
>> Any suggestions appreciated!
>>
>> Thanks
>>
>> Brent Wood
>>
>>
>> __________ Information from ESET Mail Security, version of virus
>> signature database 11719 (20150601) __________
>>
>> The message was checked by ESET Mail Security.
>> http://www.eset.com
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>>
>> __________ Information from ESET Mail Security, version of virus signature database 11719 (20150601) __________
>>
>> The message was checked by ESET Mail Security.
>> http://www.eset.com
>>
>
>
>
> __________ Information from ESET Mail Security, version of virus signature database 11720 (20150602) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>
>
> __________ Information from ESET Mail Security, version of virus signature database 11724 (20150602) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>
>
> Cheers Bernhard,
>
> Yes, I can do that, but creating the action for each layer is the
> repetitive task I want to simplify. Instead of typing the the command
> line for the action, I could just select & apply. This is less of an
> issue for me as for the users less familiar with QGIS that I'm working
> with.
>
> Like I can create a symbology once, then save it & apply it to new
> layers, I'd prefer not to have to create the action for every layer -
> instead I could create it once then save & reuse as appropriate.
> As an institutional resource, I can create a set of QGIS styles
> (symbologies) that users can copy & apply to layers, without having t go
> through the complex operation of creating it themselves. It would be
> great to be able to do the same thing with actions - create a library of
> actions for institutional WFS services that users can re-use - which is
> where your suggestion of Python is a good one - being platform independent.
>
> Thanks,
>
>    Brent
>
> ------------------------------------------------------------------------
> *From:* Bernhard Ströbl <bernhard.stroebl at jena.de>
> *To:* qgis-user at lists.osgeo.org
> *Sent:* Tuesday, June 2, 2015 5:36 PM
> *Subject:* Re: [Qgis-user] Help reusing QGIS action
>
> Hi Brent,
>
> I hope I got the intention of what you want to achieve....
> Talking about layer actions you could define the same action for each of
> your layers calling the batch script and passing the point's id. Or you
> could create a Python action (functionality provided by a plugin) that
> lists all species for each point. This would be platform independent, too.
>
> Bernhard
>
> Am 02.06.2015 um 01:06 schrieb Brent Wood:
>  > Hi,
>  > I can create an action on a biodatabase: the site data is shown on
> the map, and an action created that will retrieve and dispaly a sorted
> list of the species identified at that site. This works well, as a bash
> script for Linux or a batch file for Windows.
>  > What I'd like to be able to do is save an action, much like a style,
> to be applied to multiple layers.
>  > The use case is: open a layer filtered to show species a, then other
> layers for species b & c. I then want to see the full list of species
> caught from individual stations, by clicking on the map. Currently I
> need to create the action separately for each species - when I have
> hundreds of species, this gets very cumbersome - so storing & re-using
> the action would be useful, just as I can reuse a style for each species
> layer with catch size based symbology.
>  > Is there a way to do this now that I don't know? Do I need to file a
> ticket for this?
>  > Any suggestions appreciated!
>  > Thanks
>  > Brent Wood
>  >
>  >
>  >
>  > __________ Information from ESET Mail Security, version of virus
> signature database 11719 (20150601) __________
>  >
>  > The message was checked by ESET Mail Security.
>  > http://www.eset.com <http://www.eset.com/>
>  >
>  >
>  >
>  > Hi,
>  >
>  > I can create an action on a biodatabase: the site data is shown on the
>  > map, and an action created that will retrieve and dispaly a sorted list
>  > of the species identified at that site. This works well, as a bash
>  > script for Linux or a batch file for Windows.
>  >
>  > What I'd like to be able to do is save an action, much like a style, to
>  > be applied to multiple layers.
>  >
>  > The use case is: open a layer filtered to show species a, then other
>  > layers for species b & c. I then want to see the full list of species
>  > caught from individual stations, by clicking on the map. Currently I
>  > need to create the action separately for each species - when I have
>  > hundreds of species, this gets very cumbersome - so storing & re-using
>  > the action would be useful, just as I can reuse a style for each species
>  > layer with catch size based symbology.
>  >
>  > Is there a way to do this now that I don't know? Do I need to file a
>  > ticket for this?
>  >
>  > Any suggestions appreciated!
>  >
>  > Thanks
>  >
>  > Brent Wood
>  >
>  >
>  > __________ Information from ESET Mail Security, version of virus
>  > signature database 11719 (20150601) __________
>  >
>  > The message was checked by ESET Mail Security.
>  > http://www.eset.com <http://www.eset.com/>
>  >
>  >
>  > _______________________________________________
>  > Qgis-user mailing list
>  > Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>  > http://lists.osgeo.org/mailman/listinfo/qgis-user
>  >
>  >
>  > __________ Information from ESET Mail Security, version of virus
> signature database 11719 (20150601) __________
>  >
>  > The message was checked by ESET Mail Security.
>  > http://www.eset.com <http://www.eset.com/>
>  >
>
>
>
> __________ Information from ESET Mail Security, version of virus
> signature database 11720 (20150602) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com <http://www.eset.com/>
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>
> __________ Information from ESET Mail Security, version of virus
> signature database 11724 (20150602) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com



__________ Information from ESET Mail Security, version of virus signature database 11726 (20150603) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list