[Qgis-developer] show grid on map canvas (similiar to grid

Nathan Woodrow madmanwoo at gmail.com
Thu May 10 05:47:16 PDT 2012


 used in composer) - strategy?
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Yeah QgsVectorLayer can take 'memory' as a data provider which will
create a memory layer.

- Nathan
From: Etienne Tourigny
Sent: 10/05/2012 10:25 PM
To: Nathan Woodrow
Cc: Alister Hood; qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] show grid on map canvas (similiar to grid
used in composer) - strategy?
On Thu, May 10, 2012 at 9:06 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote=
:
> I think if=C2=A0QgsPluginLayer=C2=A0is a usable option that would be the =
way to go, or
> maybe=C2=A0 QgsVectorLayer=C2=A0 but I suspect that you will need a provi=
der for
> that.

Is there a way we can create a QgsVectorLayer in memory, without using
a provider? If not , perhaps we could use a OGR in-memory dataset
('/vsimem/') - is this used currently somewhere in qgis?

Another idea - use a QgsPluginLayer which itself contains a number of
QgsVectorLayers (e.g. polygon + polylines) to remove the need to
create a provider - but this might be cumbersome.

I'm definitely interested in collaborating with others in this!

Etienne

>
> I think having it show up in the legend is a good idea that way it can be
> turned on and off, styled, and ordered as the user needs. =C2=A0E.g. some=
times I
> might like to have yellow grid lines rather then black.
>
> - Nathan
>
> On Thu, May 10, 2012 at 10:01 PM, Etienne Tourigny <etourigny.dev at gmail.c=
om>
> wrote:
>>
>> On Thu, May 10, 2012 at 1:35 AM, Alister =C2=A0Hood
>> <Alister.Hood at synergine.com> wrote:
>> >> Date: Wed, 9 May 2012 18:00:07 -0300
>> >> From: Etienne Tourigny <etourigny.dev at gmail.com>
>> >> Subject: [Qgis-developer] show grid on map canvas (similiar to grid
>> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 used in composer) - strategy?
>> >> To: qgis-developer <qgis-developer at lists.osgeo.org>
>> >> Message-ID:
>> >>
>> >> <CA+TxYvPd-5VHoyCX4UHio9X416hKx9ZGeQ5EnnnQVaDP0L9ZCg at mail.gmail.com>
>> >> Content-Type: text/plain; charset=3DISO-8859-1
>> >>
>> >> Hi all,
>> >>
>> >> I would like to add support to draw a grid on the map canvas, in a wa=
y
>> >> 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
>> >
>> > Hi,
>> > I'm not a developer, so this might be a crazy and unnecessary idea, bu=
t
>> > would it be feasible to create a graticule _provider_?
>> >
>> > This approach would mean that like grids created with ftools, the grid
>> > would be created as a layer, but it wouldn't be file based and its ext=
ents
>> > would automatically update.
>> >
>> > Unlike the approach used in the composer, this would mean:
>> > - digitising tools could snap to the grid lines.
>> > - the identify tool could identify the grid lines.
>> > - the layer could be used for analysis (e.g. you might want to use it =
to
>> > split vector layers).
>> > - symbology and feature labelling could work just like other vector
>> > layers.
>>
>> Those are pretty cool ideas!
>> Perhaps a new QgsMapCanvasItem, rather than a provider? Or even a new
>> QgsPluginLayer or QgsVectorLayer, so this is actually a layer? In this
>> case the layer would have to be in the legend, whereas it might be
>> better to hide it from the legend.
>>
>> >
>> > If this was to actually replace the grids in the composer, some
>> > improvements to feature labelling would be needed. =C2=A0Some of these=
 would
>> > probably be good to have anyway, e.g. an option to label both ends of =
a
>> > line, and an option to align labels horizontally or vertically on the =
page,
>> > rather than N-S or E-W. =C2=A0I guess the difficult one would be provi=
ding a way
>> > to display labels outside the map frame...
>>
>> This kind of modification would require modifying the core rather than
>> making a plugin I think.
>>
>> >
>> > Regards,
>> > Alister
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>


More information about the Qgis-developer mailing list