1

I am making an atlas with a fixed scale, and want to include circles with a fixed radius (in scaled kilometers) about the center point in the atlas (see image below). I was able to do this by calculating the appropriate scale using the scale bar and a physical ruler. However, it seems like there should be a more precise way to solve this problem.

Within the expression builder of the circle height and width, the scale of the map can be retrieved with:

map_get(item_variable('map'), 'map_scale')

This returns the scale (30,000), however when I try to scale the target distance (2000 m) by this scale it doesn't match length of the scale bar (also 2 km) -- instead it is about 2/3s of the target radius.

Goal

1
  • 1
    Did you try to build a buffer by using geometry generator around each point (outside print composer)? Should much more convinient and precise. Another question: what CRS do you use?
    – MrXsquared
    May 1, 2019 at 18:23

1 Answer 1

1

Here's an alternate method for creating a circular scale "bar" for your print layout.

Create a point layer in the map canvas.

Place points on the map where you want scale bars on your print layout maps.

Style the points with geometry generator buffers. Remember that the buffer value will be the radius of the circle, so if you want a circle with a 1 km diameter, make a buffer with a 500 m radius: buffer($geometry,500)

Label the points with rule-based labeling. Create a label rule for each buffer ring.

enter image description here

Use "offset from point" placement method, and offset the labels by the buffer radius. Be sure to choose "map units." Note: use negative values to move the label up, and positive values to move it down (see this question for an explanation).

enter image description here

End result:

enter image description here


Note: If you're making maps at different scales, you might want different sized buffers for different maps. One way to achieve this is to apply scale-based visibility to the various symbol layers. Use an expression to control the "enable layer" setting. Eg, @map_scale < 50000 will hide the layer at scales between 1:50000 and 1:infinity.

2
  • Can these buffers be dynamically turned off? In some instanced multiple points might be present in the same Atlas page and I would only want the scale circles for the current point.
    – arkottke
    May 1, 2019 at 21:32
  • 1
    yes. use @atlas_feature or another atlas variable to control "enable layer" settings (at the bottom of the style panel).
    – csk
    May 2, 2019 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.