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.
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.
Any ideas?
Result with @Babel solution:
Result with control with atlas:
Result with buffered points:
Best Answer
I find a solution: control extent of map position (Route) by Expression String Builder.
For example for determining
x_min
extent I use this code:First I get
value
of Id_Route of current POI that is showing in atlas.After that I search a
feature
(Route) in Routes that have this Id_Route.After, I get
geometry
of this feature (Route).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_maxWhith 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:
https://techoverflow.net/2021/04/26/how-to-make-bounding-box-larger-by-a-percentage-in-python/
For all the position the code is for 15% of margin: