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

Alister Hood Alister.Hood at synergine.com
Thu May 10 17:22:30 PDT 2012

Hi again,

> On Fri, May 11, 2012 at 10:40 AM, Etienne Tourigny <etourigny.dev at gmail.com>
> Hi all
> On Thu, May 10, 2012 at 5:39 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> > Hi
> >
> > On Thu, May 10, 2012 at 2:06 PM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> >> I think if QgsPluginLayer is a usable option that would be the way to go, or
> >> maybe  QgsVectorLayer  but I suspect that you will need a provider for
> >> that.
> >
> > I would suggest _not_ to create another provider for grids (for use as
> > a vector layer). A grid is not really made of vector features, and
> > lots of vector operations do not make much sense for grid. An

Yes, I think most people would never use vector operations on a grid.  And I guess the digitising tools would be disabled for these layers.  But people do treat grids as features for geoprocessing,.

> > interesting approach might be to use QgsPluginLayer class, but IMHO a
> > grid is not even a layer... e.g. does it make any sense to draw some
> > other layers on top of a grid?

Certainly not usually, at least for printing, although I can imagine using a grid of alternating filled gray and white squares under the map layers, rather than grid lines over the map layers.  
I can also imagine if someone was working with point and line layers and unfilled polygon styles they might move these layers above the grid to make it easier to see them.  
Anyway, it would certainly make sense in some cases to have more than one grid "layer", to be able to symbolise them differently (which implies being able to control which one of them is above another) and turn them on and off independently.  Creating them as layers would make this simple.

> I guess it makes more sense to draw the grid on top - are there any
> uses to draw the grid below the layers? In any case, a simple
> (top/bottom) selector would suffice.

I doubt there are many cases when somebody would want grids below the layers, but I wouldn't rule it out entirely.
But I do think people would want grids below feature labels and diagrams (other map decorations are above these), and below map annotations (other map decorations are below these, although I think that they probably shouldn't be).

> > For me a grid is a good candidate to be implemented as another type of
> > decoration (currently there is north arrow, scale bar and copyright
> > label). A decoration is drawn on top of the map when map rendering has
> > finished. And symbology can still be applied when drawing grid as a
> > decoration.
> Hmm... symbology applied to what?

See below.

> Nathan's suggestion to make it a layer to be able to style it makes
> sense. Any way we can use the symbology interface on a map decoration?

I think that's exectly what Martin is saying can be done.

> Can we re-use existing widgets for this, or just a waste or time
> instead of designing a new widget?


More information about the Qgis-developer mailing list