In QGIS, I am trying to use the Create Grid for Indexing plugin more efficiently. I would like to know if it is possible to export a map composer extent to a layer (a layer with one rectangle polygon) in order to use it as the layer extent in the Create Grid for Indexing plugin.


I did something similar once but instead of creating a new layer for the map composer extent:

  1. I set up the extent from the composer
  2. Clicked the View extent in map canvas option:

    View extent in map canvas

  3. From the plugin, I selected the extent of the canvas:

    Create grid for indexing plugin

This allowed me to bypass having to create another 'mask' layer.

  • Thank you. I tried that but my canvas doesn't match my map composer proportion so it fits in the dimension but not the other. or may be I am missing something. – Charles Jul 4 '16 at 12:47
  • @user274593 - Not sure but I guess it depends on how the maps are used. I made fairly simply maps so didn't have an issue with proportion but this may be an issue if you're working with really high-quality maps. – Joseph Jul 4 '16 at 12:56
  • I'm not sure that it is a matter of quality. In my case the map in the composer is in portrait whereas my canvas is in landscape; so it fits well in height but not in width. I can manage to manually adjust my canvas proportions with my window size to fit the best to my map proportions but it can not fit perfectly. – Charles Jul 4 '16 at 13:39
  • @user274593 - Have you tried setting your composer to portrait? – Joseph Jul 4 '16 at 13:43
  • If I use approximative same proportions in the map composer and the canvas it fits fairly well but I am looking for a grid which fits perfectly in my map composer, that is why I was looking for an export of the map composer extent as a layer. – Charles Jul 4 '16 at 13:49

It's difficult to get zoom to extent to work without gaps, as you've found. It gives "best fit" when the aspect ratios don't match.

(Tip : when messing around with extents, use CtrlB to save extents on a saved layer, that way you can always get your extent back, even after closing QGIS)

Snapping indexed grid to bounding box

If you want to create a grid over the extent of a layer:-

Make sure the layer is selected in the Layers panel first, then click on Selected Layer in the plugin. It should then build the grid inside that rectangle.

If you uncheck the option add labels outside extent that will create a plain grid.. that might make things easier in composer.

You could then use composer to expand to fit the content (needs QGIS >2.12?)

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.