Geographic Information Systems Asked by Szymon Piotr Jerzy Czwart on June 16, 2021
I’m trying to achieve auto-listing of features visible (ie rendered and in Map’s extents) in a text field rendered as HTML. My idea is:
<td>Maßstab:</td><td>1:[%round(map_get(item_variables('Mapa 1'), 'map_scale'),0)%]</td>
</tr>
<tr>
<td>Koordinatensystem:</td><td>[% @project_crs %]</td>
</tr>
Is this possible without writing any elaborate functions?
//Edit: I’m adding some more info about data structure
Table of attributes of that layer is quite simple, as it only has 2 columns, ID (the befund number, integer) and a class (type of feature, string data).
I’m adding a table of attributes in print composer, linking it with polygonal layer with those Befunds. After checking box at ‘show only features visible on map’ and getting rid of header I’m pretty much good.
And table object is rendered like that with constant update:
The point is, that I’d like to fit it into the label mentioned above, optimally as a self-updating string that would resemble ‘id’, ‘id’, ‘id’. At this point I’m thinking about really painful workaround (ie splitting the table into one-cell-frames and modify integers to have commas)…
You plan to use the attribute table in the layout and then extract it content in a text field, it is smart but I think it will not be easy to do as features in your layout are very independent.
The solution I proposed is based on an expression that will calculate directly the result you want. The result could be integrated in a text field as you have done for Maßstab or Koordinatensystem.
This process is doing an intersection joining "on the fly" so you need to have the same CRS for atlas layer and target layer. If you don't then you have to add an expression to handle it and it is getting even more complicated.
First to extract features that cross the current atlas feature :
array_to_string(
aggregate(
'poly plan 2',
aggregate:='array_agg',
expression:="id",
filter:= intersects(
@atlas_geometry,
$geometry
)
)
)
To extract features that cross the map extent in your layout, then you have to change the geometry used by the intersect
. The CRS need to be the same in your target layer and in the map integrated in your layout.
array_to_string(
aggregate(
'poly plan 2',
aggregate:='array_agg',
expression:="id",
filter:= intersects(
map_get(item_variables('Mapa 1'),'map_extent'),
$geometry
)
)
)
Note : If your map item in the layout have another name, then you must change the text Mapa 1
.
Answered by Corentin Lemaitre on June 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP