I have some different routes with different POIs, and I want to show these POIs in a detailed map and also the position of the POIs in the route, showing all the routes.

enter image description here

I have two layers, one layer with the routes (LineString), with attribute Id_Route, and another layer with POIs (Points) with attributes Id_Route, Id_POI and POI_Description.

I create a Map controlled by Atlas, and Atlas is controlled by Id_POI, that shows a detailed map of POI. I also create a map that shows all the route, and a star where the POI is in the route. This map is not controlled by Atlas because if I control by Atlas, the extent change when the POI change, and I always want the same zoom. If I fixed then all works fine because the complete route is showed. My problem is when I generate an atlas with all points, when the POI is from another route, the zoom/view does not change to the new route.

How I Control/Configure Map of POI

How I Control/Configure Map of Route

Any ideas?

Result with @Babel solution:

Result with @Babel solution

Result with control with atlas:

enter image description here

Result with buffered points:

Result with buffered points

  • You had a tag for PyQGIS but presented no code attempt to illustrate what you’ve tried and where you’re stuck so I removed it.
    – PolyGeo
    Commented Jan 1, 2022 at 11:53
  • I generate JPG's with atlas in stand alone apllication (PyQgis). It's true that in this question perhaps is not important PyQgis. I marked PyQgis because perhaps solution is a PyQgis code... It's ok, thank you.
    – RBenet
    Commented Jan 1, 2022 at 12:05
  • can you use a style rule (based on atlas feature id) in the overview map?
    – Ian Turton
    Commented Jan 1, 2022 at 12:47
  • @Ian Turton, I tried also with overview map, but overview show a part of map that shows POI, not of the route.
    – RBenet
    Commented Jan 1, 2022 at 13:04
  • 1
    You will have to describe exactly which steps you took and what your current setup looks like in detail. Commented Jan 1, 2022 at 13:16

2 Answers 2


I find a solution: control extent of map position (Route) by Expression String Builder.

enter image description here

For example for determining x_min extent I use this code:

x_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))))

First I get value of Id_Route of current POI that is showing in atlas.

Id_Route = attribute(@atlas_feature,'Id_Route')

After that I search a feature (Route) in Routes that have this Id_Route.

Feature = get_feature( 'Routes','Id_Route',Id_Route)

After, I get geometry of this feature (Route).

Geometry = geometry(Feature)

Finally I get de x_min of the Geometry (Route).


For x_max,y_min and y_max, I do the same, but from Geometry(Route) I extract x_max,y_min and y_max

Whith this code I have a map just with route extension, but I want some pad arround the route (15%).

I find this page where is very well explained how to do:


xmin -= 0.15 * (xmax - xmin)
xmax += 0.15 * (xmax - xmin)
ymin -= 0.15 * (ymax - ymin)
ymax += 0.15 * (ymax - ymin)

For all the position the code is for 15% of margin:

x_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))-( 0.15 * (x_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) - x_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))))

y_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) - (0.15 * (y_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) - y_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))))

x_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) + (0.15 * (x_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) - x_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))))

y_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) + (0.15 * (y_max(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route')))) - y_min(geometry( get_feature( 'Routes','Id_Route',attribute(@atlas_feature,'Id_Route'))))))
  1. Add your map to the layout, set Atlas (what you already did)

  2. Add another map to the layout, create an Overview and set Map frame to follow the first map (see screenshot). You can set a fixed value for this overview map - it is not affected by atlas.

    [3. Optional: define different styles with rule based syling in the QGIS main window a) for the current atlas feature with the filter expression @atlas_featureid =$id (red star on the screenshot) b) all other features with the filter expression @atlas_featureid <> $id (white dots).]

The overview map will show the whole extent of the layer. If you want to have it zoomed in a bit to the current atlas feature, on the overlay map, click also Controlled by atlas and set a Margin around feature - it can be quite large, e.g. 2000%. Be aware: if using a point layer as coverage layer for the atlas, you won't be able to choose this option. Use a polygon layer, representing the points, as coverage layer instead. Create a (small) buffer around the points and use this as coverage layer for the atlas.

enter image description here

enter image description here

  • thank you so much for your answer. I try what you say, but I have one problem. The 2nd Map (Route Map), show all extens of the feature in the layer, so the extens is very big, and the route see small. Do you know if I can control zoom?
    – RBenet
    Commented Jan 1, 2022 at 17:20
  • I add a screen capture with resault in my question.
    – RBenet
    Commented Jan 1, 2022 at 17:26
  • I don't know why I can't select Margin around feature. I add print screen. Thank you so much for your attention.
    – RBenet
    Commented Jan 1, 2022 at 17:38
  • See 2nd update to my answer.
    – Babel
    Commented Jan 1, 2022 at 17:50
  • I do what you say and the problem now, is the limit arround is 9.999%, and is not enough. Thank you again for your help!!!!!
    – RBenet
    Commented Jan 1, 2022 at 19:41

Your Answer

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

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