Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get list of map layers from a map item in the layout #27561

Closed
qgib opened this issue Aug 30, 2018 · 5 comments
Closed

Unable to get list of map layers from a map item in the layout #27561

qgib opened this issue Aug 30, 2018 · 5 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions

Comments

@qgib
Copy link
Contributor

qgib commented Aug 30, 2018

Author Name: Harrissou Santanna (@DelazJ)
Original Redmine Issue: 19736
Affected QGIS version: 3.3(master)
Redmine category:expressions


If I write in a label item of the layout an expression like @map_get(item_variables('Map 1'), 'map_scale')@ it returns the current scale of the "Map 1" item.
If I write @map_get(item_variables('Map 1'), 'map_layers')@, I get an empty label. Same thing with map_layer_ids.

@qgib
Copy link
Contributor Author

qgib commented Aug 30, 2018

Author Name: Nyall Dawson (@nyalldawson)


That's because the values aren't strings or numbers - you need to format them by converting the list to a string, etc. It's the same behaviour with geometries, dates, intervals, etc.

@qgib
Copy link
Contributor Author

qgib commented Aug 31, 2018

Author Name: Harrissou Santanna (@DelazJ)


Ok I get it using something like @array_to_string( array_foreach( map_get( item_variables( 'Map 1' ), 'map_layers'), layer_property(@element, 'name')))@.
Just awesome!!! Thanks.

Then I remark that I get all the layers checked in the Layers panel and not only the layers whose features are visible in the map item. Likewise, when I lock the map item with a map_theme i get the map theme layers (regardless what is displayed in the main canvas, which is great).
BUT I wonder if there should not be a method to filter list of layers by map item content (like the legend item option).

@qgib
Copy link
Contributor Author

qgib commented Aug 31, 2018

Author Name: Nyall Dawson (@nyalldawson)


Ok, but that's a feature request ;)

@qgib
Copy link
Contributor Author

qgib commented Sep 1, 2018

Author Name: Harrissou Santanna (@DelazJ)


Done in #27570


  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Sep 1, 2018
@qgib
Copy link
Contributor Author

qgib commented Sep 2, 2018

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to invalid

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

No branches or pull requests

1 participant