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

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Wed Jul 13 02:54:52 PDT 2022


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
---------------------------------------------
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
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885



More information about the QGIS-Developer mailing list