6

Is there a QGIS plugin available or a processing model to calculate and populate fields that can be used to label the adjacent pages in a map book?

Although there are tools to create vector grids, I cannot find one to calculate the adjacent polygons. i.e. which adjoining polygon is N,S,E and W of the existing polygon, or even better in all 8 directions surrounding a regular polygon.

This is how it works in ArcGIS;

http://resources.arcgis.com/en/help/main/10.1/index.html#//007000000009000000

I am looking to modify a python script by Ujaval Gandhi on http://www.qgistutorials.com/en/docs/find_neighbor_polygons.html and will post further if I have anything to add. (It currently outputs the surrounding polygons in a single field.)

  • Ujaval Gandhi replied to a question I asked on his site which I will attempt next; "It is possible. Instead of _NEW_NEIGHBORS_FIELD, you would have 8 variables and then store values of each neighbor in them. Finding which of the neighbors is north vs. north-east will not be as straightforward but you can try using the xMinimum(), yMinimum(), xMaximum(), yMaximum() values of geom.boundingBox() to determine those." – Lee Sep 21 '16 at 21:54
  • Even though I think the accepted answer is fine, sometimes you won't be able to leave space for adjacent grid cells and their labels. Yesterday I created a Processing script for the use case you've described (I didn't know the ArcGIS equivalent until now). It's currently generating four fields (left, right, above, below) but can be improved to generate 8. Have a look at this answer for installation details: gis.stackexchange.com/questions/214300/… Let me know if you find it useful or even worth posting it as an answer here. – Germán Carrillo Oct 24 '16 at 12:51
5

It would be easy to replicate this functionality in QGIS using Python, but I don't think it's necessary to achieve what you want.

Using QGIS' excellent atlas functionality you can style the atlas feature separately to other features on the layer.

On the style tab of your grid layer choose rule-based styling and set a filter for '$id = @atlas_featureid' and set the style for your atlas feature. Then set an 'Else' filter that will be used for all other features.

Do exactly the same on the labelling tab, so that the atlas feature doesn't get labelled but other features do.

When you create your atlas, 'set margin around feature' to control how much of the surrounding tiles are shown. Also, make sure your map frame is square (assuming you have a square grid)!

The beauty of this is you've got all of the QGIS styling options at your disposal so you can make it look however you want.

Hope this helps

Tom

qgis atlas

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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