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

Shape Items (Layout) and geometry generator #39159

Closed
ludovico85 opened this issue Oct 3, 2020 · 3 comments · Fixed by #45165
Closed

Shape Items (Layout) and geometry generator #39159

ludovico85 opened this issue Oct 3, 2020 · 3 comments · Fixed by #45165
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks

Comments

@ludovico85
Copy link

The shape items tool in the print layout window allows to customize the style of the selected shape also with the geometry generator. However, it seems that this function in actually disabled.

  1. Create a layout
  2. Add a shape item such as a rectangle
  3. Style the rectangle with the geometry generator. Trying to create the centroid of the rectangle with the expression: centroid($geometry)
  4. Nothing happens

Cattura

@ludovico85 ludovico85 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 3, 2020
@gioman gioman added Feedback Waiting on the submitter for answers Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels Oct 3, 2020
@gioman
Copy link
Contributor

gioman commented Oct 3, 2020

@ludovico85

QGIS version?

Operating System?

@ludovico85
Copy link
Author

QGIS 3.10.10 and 3.14.16
Windows 10

@pigreco
Copy link
Sponsor Contributor

pigreco commented Oct 3, 2020

I confirm, the geometry generator seems disabled even if I used a geometry in the form wkt: geom_from_wkt ('Polygon ((0 5, 10 5, 10 0, 0 0, 0 5))')

Osgeo4W64 Win 10 QGIS 3.10, 3.14, master

@gioman gioman removed the Feedback Waiting on the submitter for answers label Oct 24, 2020
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 17, 2021
Usually a geometry generator expression must return a geometry
in the associated layer's CRS. But this doesn't work in situations
where a geometry generator symbol is NOT associated with a layer,
e.g. when used in a layout item.

So add a new option to allow users to specify which unit the expression
will return geometries in, with choices of map units (the default,
previous behavior), millimeters, pixels, inches and points.

When millimeters, points, inches or pixels is selected then
the @map_geometry variable will be available for the expression,
and contain the feature's geometry in the specified units (relative
to the map frame). (The $geometry variable remains available and
still in layer CRS, in case an expression needs to calculate the
original area, perimeter, etc in real-world units while returning
results in a different unit!)

A step toward fixing qgis#39159
nyalldawson added a commit that referenced this issue Sep 20, 2021
Usually a geometry generator expression must return a geometry
in the associated layer's CRS. But this doesn't work in situations
where a geometry generator symbol is NOT associated with a layer,
e.g. when used in a layout item.

So add a new option to allow users to specify which unit the expression
will return geometries in, with choices of map units (the default,
previous behavior), millimeters, pixels, inches and points.

When millimeters, points, inches or pixels is selected then
the @map_geometry variable will be available for the expression,
and contain the feature's geometry in the specified units (relative
to the map frame). (The $geometry variable remains available and
still in layer CRS, in case an expression needs to calculate the
original area, perimeter, etc in real-world units while returning
results in a different unit!)

A step toward fixing #39159
@nyalldawson nyalldawson self-assigned this Sep 21, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 21, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 21, 2021
nyalldawson added a commit that referenced this issue Sep 22, 2021
espinafre pushed a commit to espinafre/QGIS that referenced this issue Sep 29, 2021
Usually a geometry generator expression must return a geometry
in the associated layer's CRS. But this doesn't work in situations
where a geometry generator symbol is NOT associated with a layer,
e.g. when used in a layout item.

So add a new option to allow users to specify which unit the expression
will return geometries in, with choices of map units (the default,
previous behavior), millimeters, pixels, inches and points.

When millimeters, points, inches or pixels is selected then
the @map_geometry variable will be available for the expression,
and contain the feature's geometry in the specified units (relative
to the map frame). (The $geometry variable remains available and
still in layer CRS, in case an expression needs to calculate the
original area, perimeter, etc in real-world units while returning
results in a different unit!)

A step toward fixing qgis#39159
espinafre pushed a commit to espinafre/QGIS that referenced this issue Sep 29, 2021
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! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants