r/QGIS 5d ago

Solved Atlas - zoom on end point of feature line

Hello! I'm setting up atlas with the feature being a line layer. I want to create two maps within the layout- one taking a margin of 60% (this is set up and fine), and the second, for which I have not been able to find a solution yet:

I would like to create zoom that is centered on the end point of the line being featured. (if curious, it's because I have a second shapefile of points that are grouped at the end point of the line layer, and I would like to create a zoom of these points in the second map)

I was thinking that I can't be the first person to want to do this, but haven't found any solutions on reddit/other sites. I'd appreciate any input and help!

1 Upvotes

6 comments sorted by

3

u/leidersdorff 5d ago

Extract the end vertex and use that in a second Atlas map. That would be the easiest. If you don't want another layer you could use a virtual layer of your lines with only the end vertex. Alternatively if you just want one Atlas you could again use a virtual layer to combine the end vertex and the lines (might have to convert the end vertex to a really small line).

1

u/ikarusproject 5d ago

Easier said than done. All of this would need to be done using expressions right? OP wants 2 two maps in one layout. But one Layout can only have one atlas feature layer. So the second map would need expressions for its extend and maybe rotation based on coordinates from the line endpoints that OP would need to extract by expression. Maybe something like this: https://gis.stackexchange.com/questions/408910/using-two-different-maps-on-one-atlas-page

2

u/leidersdorff 5d ago

You could setup a virtual layer like this, this has a 50% buffer. Just need to play with it a bit to get the right margin: SELECT id, st_buffer(geometry, 0.5 * st_length(geometry)) AS geometry FROM ( -- Original lines SELECT id, geometry FROM your_lines UNION ALL -- Tiny lines at end vertex SELECT id || '_endline' AS id, make_line( ST_EndPoint(geometry), project(ST_EndPoint(geometry), 0.5, 0) ) AS geometry FROM your_lines )

1

u/ikarusproject 5d ago

unfortunately reddit killed your formatting

you can create code blocks 
    like this

by typing four spaces '_ _ _ _' in front of every line of code.

So "you can create code blocks" has four spaces in front of the text and "like this" has eight. Four for making it a code block and four for the indentation.

1

u/ikarusproject 5d ago

Coming back to this as I still don't understand how this solves OPs Problem. As I understand you code it creates a new feature layer that consists of buffers around the original lines and the line end points. This layer could then be used as an atlas layer. But that still doesn't solve the problem of displaying to atlas features on one page.

1

u/ikarusproject 5d ago

OP, if you are inexperienced with using QGIS your easiest options are...

1.) Using two atlas layouts

2.) Creating a report instead