3

I created a grid with plugin Create Grid for Indexing. Until now all fine.

But how can I use the grid (Create Grid for Indexing) in the print composer?

The task:

I have a map and a overview. I want to have information about the location of the map, for example, "The map is in M1" or "The map is in G5", etc.

How to make that in the print composer and using Create Grid for Indexing?

1 Answer 1

3

I tried it to create an atlas with output from the plugin and had problems, but got it to work, eventually! (disclosure - I'm the plugin author)

The plugin creates a memory layer. It seems that you can't use memory layers as coverage in Atlas. But you can get around that by saving the layer as a shapefile or other format (I suggest you do this anyway, as the memory layer will be lost when you close QGIS).

To get around this,

  • set the CRS in the memory layer if required (the plugin doesn't do that at the moment)
  • save the memory layer to a new shapefile layer
  • use the new shapefile layer as coverage in the atlas
  • add a piece of text, and use the following expression This is map [% "name" %]

Name is the field which contains the cell reference (A1,A2,B15 etc) You should now be able to produce one map per grid square, like this...

enter image description here

.. or with an overview

enter image description here

6
  • Thanks. I wasn't understanding but I realized that must activate the Atlas option. But in expressing how can I make reference to a field of the grid layer? Or how to make a connection between the 2 layers? How does the layer of polygons can receive information from grid layer?; a field could receive the reference of a cell of the grid ... Otherwise I have to go to all the polygons and manually place the reference cell; "A1", "B1-B2", "K2-L2", ... Commented Jun 1, 2016 at 9:28
  • 1
    ah, so you want to mark each polygon / point with the grid cell it's in? For that, you need a spatial join (Vector > Data Management Tools > Join attributes by Location), that will do what you're after. This tutorial is a good starting point, they're using county boundaries but the principle is the same for grids.
    – Steven Kay
    Commented Jun 1, 2016 at 13:11
  • Thanks again.I followed and understood the tutorial, but has some polygons that sometimes extend for more than one cell the result is not the desirable. Is there any way to extract only one point of each polygon? It would be a step to add before using this method. Commented Jun 1, 2016 at 23:12
  • 1
    in that case, you could extract the centroid of each polygon, and use that to join to the grid cells (so make a point from each polygon) It would be ideal if you could join to the grid cell with the greatest overlap (not just the first one found) but that's a bit more difficult. Centroids are easier :)
    – Steven Kay
    Commented Jun 2, 2016 at 6:58
  • 1
    Very well. I used Vector> Geometry tools> Polygon centroids. Then another step to have (send) the grid cell name to the polygon table; I joined the resulting table with the polygons table, Properties> Joins. Final step; saved it as new polygon layer. Too bad it take so much work. Uhf! Commented Jun 2, 2016 at 12:35

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.