[Qgis-developer] Re: show grid on map canvas (similiar to grid used in composer) - strategy?

Etienne Tourigny etourigny.dev at gmail.com
Sun May 13 14:49:21 PDT 2012

Hi folks,

there have been a number of interesting suggestions, I will try to
summarize them this week.

I quickly put together a basic grid in the main map canvas, using the
interface and logic from the map composer.  I have decided to
implement the grid as a decoration and accordingly added an item to
the Decoration menu.  I have also improved the decorations management
to be able to draw the decorations in a particular order (with a new
class QgsDecorationItem), so that other decorations are on top of the

There is support for grid annotations, but only inside the map border
currently.  Line symbology is still basic (line width+color).

Basically I think there could be 2 concurrent and complementary ways
to implement grids:

1) basic grid in core, similar to what is already in the composer map
(and in my branch)
2) more refined grid(s) as plugin/vector layers, whose rendering order
can be fine-tuned

Those interested can have a look at my github branch:



On Wed, May 9, 2012 at 6:00 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> Hi all,
> I would like to add support to draw a grid on the map canvas, in a way
> similar to what is done in the map composer (although perhaps without
> the annotations on the borders).
> What should be the approach used?
> 1) plugin or core?
> 2) rubberbands or basic plot functions triggered after mapCanvas update?
> I think both drawing strategies are possible using a plugin.
> It would be best to write in the core, assuming there is sufficient
> interest in this, but it will take time to trickle down to the stable
> version (an argument for making it a plugin).
> I know the current workaround is to create a vector grid with ftools,
> but that is a little clunky.
> Any thoughts?
> Etienne

More information about the Qgis-developer mailing list