Actually, you already did most of the work required to determine the tiles that you want to print using atlas. But the point is how to adjust everything together to show only the tile IDs that you need. To demonstrate my idea, I will use in this example a DEM image and a grid vector file, as you can see below:
First we need to show the label of each grid.
In the layout view, I used grid as the coverage layer in atlas, I created two maps: the main view window map, and an index map that shows only the grid, as you can see below:
Then I did the following:
- I adjusted the scale of the index map to show the entire grid extent
then I fixed the scale
- I fixed the view extent to prevent the map from panning when using
Preview atlas
, and
- I enabled the
Overview
to see the extent and location of the main
view map, as you can see below:
For the main view window map, I fixed the scale to the extent of each grid block, to be sure that the scale will not be changed if anything happen, as you can see below;
Using an index map, you can easily see the ID and location of each tile with reference to other tile, even when you turn off the grid from the main view map window. For example, the following map has a tile ID=14, and you can see the surrounding tile IDs.
Update:
I will update my answer because I realized that you wanted to show the page number index of the surrounding layouts not the IDs of surrounding layouts.
To ease the understanding of the process, I will update the ID numbers in the index map to show the layout page number, as shown below:
Since the IDs that I have start from 0 (Zero), the ID of first grid shown on the index map will start from 3. Therefore, I want to change the page number to start from 1 by subtracting 2 from ID number in Atlas: Page number: ID -2
, then I will use the current page number as a reference in the expression to create labels for current page, previous page, next page, up page and below page, as follows:
Current Page has this expression in the label text box: Current Page Number: [%@atlas_pagename%]
Previous Page expression: [%if((@atlas_pagename = 1), Null, '↑ Page Number: ' || (@atlas_pagename - 1))%]
since there are no pages before 1
Next Page expression: [%if( (@atlas_pagename = 25), Null, '↓ Page Number: ' || (@atlas_pagename + 1))%]
since there are no pages after 25
Up Page expression: [%if((@atlas_pagename <= 6),NULL,'↑ Page Number: ' || (@atlas_pagename -6))%]
since there are no pages before 6 in the upper direction
Below Page expression: [%if((@atlas_pagename >= 20), Null, '↓ Page Number: ' || (@atlas_pagename + 6))%]
since there are no pages after 20 in the lower direction
Some output results:
Best Answer
Ok. My bad. The error was mine.
The adjustSizeToText must be in the final of the definition of characteristics of the text. Sorry for that. If anyone has this problem, please put the adjustSizeTotext in the end, like this: