[QGIS-Developer] Overlay expression function without a current object

Andreas Neumann a.neumann at carto.net
Wed Jul 13 03:32:04 PDT 2022


Hi Stefan,

Excellent - it works fine! Thanks for this solution.

As someone who was quite a bit involved with aggregate expression 
functions I should have thought about that solution myself - but 
apparently, that was too long ago ...

Many thanks for this solution - So good to have QGIS expression power 
users around!

Andreas

On 2022-07-13 11:54, Stefan Giese (WhereGroup) via QGIS-Developer wrote:

> Hi Andreas,
> 
> you can use the aggregate function for this, something like:
> 
> aggregate(layer:='layer1',
> aggregate:='concatenate',
> expression:="name",
> filter:=intersects(
> map_get( item_variables( 'Karte 1'), 'map_extent_center' ), $geometry),
> concatenator:=',')
> 
> and no need to build a point with make_point, the item variable 
> map_extent_center is already a point.
> 
> Best regards
> 
> Stefan
> 
> Am 13.07.2022 um 09:33 schrieb Andreas Neumann via QGIS-Developer:
> 
>> Hi,
>> 
>> I would like to use the "overlay_within" expression function, but in 
>> layout context - and in this case I dont have a "current_feature".
>> 
>> The goal is to find out the municipality from the map center of my 
>> main map in the layout (but not in atlas context).
>> 
>> What I tried:
>> 
>> -----------
>> 
>> with_variable(
>> 'current_geometry',
>> make_point(
>> x( map_get( item_variables( 'Hauptkarte'), 'map_extent_center' ) ),
>> y( map_get( item_variables( 'Hauptkarte'), 'map_extent_center' ) )
>> ),
>> overlay_within(
>> layer:='Gemeindegrenzen',
>> expression:=gemeindename
>> )
>> )
>> 
>> ------------------
>> 
>> But apparently the "overlay_within" geometry function needs a 
>> "$currentfeature" - which I don't have, but could create artificially 
>> with make_point from the map center.
>> 
>> Is there any way to "artificially" create a "$currentfeature", so that 
>> my overlay expression function would work?
>> 
>> Thanks for any ideas,
>> 
>> Andreas
>> 
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> --
> Mit freundlichen Grüßen
> Stefan Giese
> Projektleiter/Consultant
> ---------------------------------------------
> Aufwind durch Wissen!
> Jetzt neu: Web-Seminare und Online-Schulungen
> bei der www.foss-academy.com [1]
> ---------------------------------------------
> WhereGroup GmbH
> Schwimmbadstr. 2
> 79100 Freiburg
> Germany
> 
> Tel.: +49 (0)761 / 519 102 - 61
> Fax: +49 (0)761 / 519 102 - 11
> 
> stefan.giese at wheregroup.com
> www.wheregroup.com [2]
> Geschäftsführer:
> Olaf Knopp, Peter Stamm
> Amtsgericht Bonn, HRB 9885
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



Links:
------
[1] http://www.foss-academy.com
[2] http://www.wheregroup.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220713/ecc151f7/attachment-0001.htm>


More information about the QGIS-Developer mailing list