Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
Hi Bob, Output looks really nice but I see 2 issues: 1 - grass is optional, not part of qgis core 2 - made for PS output, may not fit nicely with the composer nor the map canvas Perhaps there is a workaround for 2 ? Etienne On Mon, May 14, 2012 at 2:47 AM, Bob and Deb bobd...@gmail.com wrote: I wonder if http://grass.osgeo.org/wiki/Ps.output might give good ideas for drawing a grid on the map canvas. On Wed, May 9, 2012 at 2:00 PM, Etienne Tourigny etourigny@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 ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
I was mostly interested in seeing qgis having similar grid symbology to ps.output. On May 14, 2012 9:51 AM, Etienne Tourigny etourigny@gmail.com wrote: Hi Bob, Output looks really nice but I see 2 issues: 1 - grass is optional, not part of qgis core 2 - made for PS output, may not fit nicely with the composer nor the map canvas Perhaps there is a workaround for 2 ? Etienne On Mon, May 14, 2012 at 2:47 AM, Bob and Deb bobd...@gmail.com wrote: I wonder if http://grass.osgeo.org/wiki/Ps.output might give good ideas for drawing a grid on the map canvas. On Wed, May 9, 2012 at 2:00 PM, Etienne Tourigny etourigny@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 ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
I wonder if http://grass.osgeo.org/wiki/Ps.output might give good ideas for drawing a grid on the map canvas. On Wed, May 9, 2012 at 2:00 PM, Etienne Tourigny etourigny@gmail.comwrote: 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 ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On Fri, May 11, 2012 at 12:40 AM, Etienne Tourigny etourigny@gmail.com wrote: 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? 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? Can we re-use existing widgets for this, or just a waste or time instead of designing a new widget? It is fairly easy to provide a GUI where users would select/modify the symbol for drawing grid lines (all necessary widgets are in qgis_gui library - QgsSymbolV2SelectorDialog, QgsSymbolV2PropertiesDialog). For drawing itself you only have to construct a QgsRenderContext instance and issue calls to QgsLineSymbolV2::renderPolyline(...). Before first render call make sure to initialize the symbol with startRender() and at the end stopRender(). To get screen coordinates from map coordinates there is QgsMapToPixel utility class. Regards Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On Fri, May 11, 2012 at 3:14 AM, Martin Dobias wonder...@gmail.com wrote: On Fri, May 11, 2012 at 12:40 AM, Etienne Tourigny etourigny@gmail.com wrote: 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? 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? Can we re-use existing widgets for this, or just a waste or time instead of designing a new widget? It is fairly easy to provide a GUI where users would select/modify the symbol for drawing grid lines (all necessary widgets are in qgis_gui library - QgsSymbolV2SelectorDialog, QgsSymbolV2PropertiesDialog). For drawing itself you only have to construct a QgsRenderContext instance and issue calls to QgsLineSymbolV2::renderPolyline(...). Before first render call make sure to initialize the symbol with startRender() and at the end stopRender(). To get screen coordinates from map coordinates there is QgsMapToPixel utility class. Thanks Martin, this is great to know. Existing code (composer grid) does not seem use this infrastructure. Would it make sense to create a new qgisgui element (or other class) to deal with grids, and re-use this code in the composer? Or perhaps just draw in the composer whatever grid(s) have been defined by the user in the main canvas? Are there any documentation/examples on using qgisgui elements, other than the api? Regards, Etienne Regards Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
I'm very interested in user-definable grid functionality, and I was planning on implementing something myself for a plugin I'm writing. My needs are to have the grid set to an arbitrary angle, and ideally to know which grid square the user has clicked in, relative to a user-defined origin. If anyone wants to collaborate, or just has ideas on how best to implement it, let me know. Regards, JD On 10 May 2012 05:35, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. If this was to actually replace the grids in the composer, some improvements to feature labelling would be needed. Some 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. I guess the difficult one would be providing a way to display labels outside the map frame... Regards, Alister___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- One of the advantages of being disorderly is that one is constantly making exciting discoveries. - AA Milne ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On Thu, May 10, 2012 at 1:35 AM, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. Some 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. I guess the difficult one would be providing 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On Thu, May 10, 2012 at 6:37 AM, John Donovan mersey.vik...@gmail.com wrote: I'm very interested in user-definable grid functionality, and I was planning on implementing something myself for a plugin I'm writing. My needs are to have the grid set to an arbitrary angle, and ideally to know which grid square the user has clicked in, relative to a user-defined origin. Can this angle be defined in terms of a projection, or is rather arbitrary with an origin and angle, relative to current projection? Could your needs be met with a (polygon) vector layer, which allows you to select one of the polygons? If anyone wants to collaborate, or just has ideas on how best to implement it, let me know. Regards, JD On 10 May 2012 05:35, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. If this was to actually replace the grids in the composer, some improvements to feature labelling would be needed. Some 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. I guess the difficult one would be providing a way to display labels outside the map frame... Regards, Alister___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- One of the advantages of being disorderly is that one is constantly making exciting discoveries. - AA Milne ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
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 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. E.g. sometimes I might like to have yellow grid lines rather then black. - Nathan On Thu, May 10, 2012 at 10:01 PM, Etienne Tourigny etourigny@gmail.comwrote: On Thu, May 10, 2012 at 1:35 AM, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. Some 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. I guess the difficult one would be providing 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On 10 May 2012 13:03, Etienne Tourigny etourigny@gmail.com wrote: On Thu, May 10, 2012 at 6:37 AM, John Donovan mersey.vik...@gmail.com wrote: I'm very interested in user-definable grid functionality, and I was planning on implementing something myself for a plugin I'm writing. My needs are to have the grid set to an arbitrary angle, and ideally to know which grid square the user has clicked in, relative to a user-defined origin. Can this angle be defined in terms of a projection, or is rather arbitrary with an origin and angle, relative to current projection? Could your needs be met with a (polygon) vector layer, which allows you to select one of the polygons? My needs are that the origin and angle are independent of the projection, and I was thinking of just creating a polygon layer similar to fTools'. It would be nice though to make it smart, so that the user can easily change the number of cells for instance, also so that the grid's settings are stored in the project file rather than as a vector file. -JD ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On 10 May 2012 13:06, Nathan Woodrow madman...@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 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. E.g. sometimes I might like to have yellow grid lines rather then black. Good idea. I had originally thought to hide it from the legend so it was just considered an overlay, but to be able to use the QGIS styling functionality makes a lot of sense. -JD ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
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 madman...@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. 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. E.g. sometimes I might like to have yellow grid lines rather then black. - Nathan On Thu, May 10, 2012 at 10:01 PM, Etienne Tourigny etourigny@gmail.com wrote: On Thu, May 10, 2012 at 1:35 AM, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. Some 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. I guess the difficult one would be providing 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On Thu, May 10, 2012 at 9:25 AM, Etienne Tourigny etourigny@gmail.com wrote: On Thu, May 10, 2012 at 9:06 AM, Nathan Woodrow madman...@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. 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? nevermind - just saw QgsMemoryProvider! Any way the provider classes could be in the API documentation??? 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. E.g. sometimes I might like to have yellow grid lines rather then black. - Nathan On Thu, May 10, 2012 at 10:01 PM, Etienne Tourigny etourigny@gmail.com wrote: On Thu, May 10, 2012 at 1:35 AM, Alister Hood alister.h...@synergine.com wrote: Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. Some 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. I guess the difficult one would be providing 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
Hi On Thu, May 10, 2012 at 2:06 PM, Nathan Woodrow madman...@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 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? 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. Regards Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
Hi all On Thu, May 10, 2012 at 5:39 PM, Martin Dobias wonder...@gmail.com wrote: Hi On Thu, May 10, 2012 at 2:06 PM, Nathan Woodrow madman...@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 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? 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. 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? 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? Can we re-use existing widgets for this, or just a waste or time instead of designing a new widget? Regards Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
On 11/05/2012, at 8:22, Alister Hood alister.h...@synergine.com wrote: 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). +1 I would definitely want it below labels and annotations at least; and I can also easily think of situations where I might want to move it below other layers. -ramon.___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy?
Date: Wed, 9 May 2012 18:00:07 -0300 From: Etienne Tourigny etourigny@gmail.com Subject: [Qgis-developer] show grid on map canvas (similiar to grid used in composer) - strategy? To: qgis-developer qgis-developer@lists.osgeo.org Message-ID: ca+txyvpd-5vhoycx4uhio9x416hkx9zgeq5ennnqvadp0l9...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 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 Hi, I'm not a developer, so this might be a crazy and unnecessary idea, but 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 extents 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. If this was to actually replace the grids in the composer, some improvements to feature labelling would be needed. Some 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. I guess the difficult one would be providing a way to display labels outside the map frame... Regards, Alister___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer