Hi Andreas,
I don't know if it is the best way for doing it, but I generally add the
current feature and the current layer as input parameters of the custom
function:
def my_function(layer_name, curr_feat, feature, parent):
They are set as inputs in this way when calling the custom function:
Hey Andreas,
Parent means the parent expression itself. So in a function, you can know
what the whole expression is e.g it points to the instance of.
You can't really know what the layer because expressions are not always
layer bound and QgsFeatures don't hold a reference to the layer they are
Actually, there would also be the "context" which gives access to the
@layer variable (a QgsVectorLayer object) and other additional things.
It's just slightly more complex to set up because it's not proxied to
the @qgsfunction.
One will need to subclass QgsExpression.Function as done here:
On 5 May 2017 at 22:08, Matthias Kuhn wrote:
>
> I think we should also send this to the @qgsfunction in QGIS 3.
>
Agreed. Shall I assign a ticket to you or will you file a PR for this?
Nyall
___
QGIS-Developer mailing list
Hi,
If one creates a custom python expression, one gets a reference to the
"feature" and the "parent".
Question: what is "parent" referring to? What object type is it?
Is it somehow possible in the Python script to get a reference to the
layer the feature is part of? Would there be some
Hi,
Finally, with the support from Matthias, I got a working example of my
custom Python expression:
@qgsfunction(args='auto', group='Custom', usesgeometry=False)
def get_ews_anlage_nr(gemeinde, feature, parent):
AnlageLayer =
QgsMapLayerRegistry.instance().mapLayersByName('Anlage')[0]
I hope you don't mind very verbose docs ;)
https://github.com/qgis/QGIS/blob/fd25288a6444c1fd6fb965a408550992d7d1f84b/python/user.py#L69-L94
On 05/05/2017 02:35 PM, Nathan Woodrow wrote:
> Yes please :)
>
> On Fri, May 5, 2017 at 10:29 PM, Matthias Kuhn
Hi,
I have a basic example using aggregates:
--
@qgsfunction(args='auto', group='Custom', usesgeometry=False)
def get_ews_anlage_nr(gemeinde, feature, parent):
AnlageLayer =
QgsMapLayerRegistry.instance().mapLayersByName('Anlage')[0]
maxVal =
QGIS has got a new GSoC project.
Congratulations
-- Forwarded message --
From: Margherita Di Leo
Date: Fri, May 5, 2017 at 10:19 AM
Subject: OSGeo welcomes 15 GSoC students!
To: news_i...@osgeo.org
Cc: "gsoc-adminosgeo.org"
Hi,
Does someone have an example how to use QgsVectorLayer.aggregate() from
Python?
How would the syntax for the parameters in the
QgsAggregateCalculator.calculate() method look like in Python?
Thanks,
Andreas___
QGIS-Developer mailing list
On 05/05/2017 02:22 PM, Nyall Dawson wrote:
> On 5 May 2017 at 22:08, Matthias Kuhn wrote:
>>
>> I think we should also send this to the @qgsfunction in QGIS 3.
>>
>
> Agreed. Shall I assign a ticket to you or will you file a PR for this?
>
> Nyall
>
Is backwards
Hi,
in a QGIS-plugin I need to read a template project file (*.qgs), modify it to
adapt it to the currently loaded database
etc. using xml.etree.ElementTree, write it and read it again.
qgsxml.write(projectfile) # writemodified project file
project =
Hi All,
please create an issue about this crashing:
https://issues.qgis.org/projects/qgis/issues/
note that devs need as much as info possible (Operating System, versions
used, plugins used, and actual things to do to reproduce the crash, see
I am adding this to the developers mailing list as it is something to pay
attention to. It looks like there are a number of individuals that are
having QGIS crash.
On Fri, May 5, 2017 at 12:45 PM, Armin Konrad wrote:
> I have the same problem and it is really annoying. The
Plugin RS approval by pcav.
The plugin version "[1220] RS 0.2" is now approved
Link: http://plugins.qgis.org/plugins/NITK_RS-GIS_17/
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info:
15 matches
Mail list logo