[Qgis-developer] Rendering Real-Time Data in QGIS

Martin Dobias wonder.sk at gmail.com
Thu Feb 5 12:24:37 EST 2009


On Thu, Feb 5, 2009 at 1:47 PM, Chee Kiang Lim <cheekiang.lim at gmail.com> wrote:
> Hi,
>
> I'm new to the QGIS API and have explored it very briefly. I am trying to
> write a c++ plugin that will take in the locations of approximately
> 100 vessels and render their current position (which varies with time)on top
> of an underlying map. I used polygons to represent those vessels on a vector
> layer using the memory provider. Each update involves deleting old features
> and adding new ones followed by refreshing of mapcanvas triggered when
> changes are committed. As there is a need to render updates at a high
> frequency for real time display, with positional data coming in at about
> 1-2Hz, the application was too occupied refreshing the canvas. This makes
> the application unresponsive to subsequent user commands. I tried
> using update(Rect of changedExtent) for localized painting/canvas refreshing
> but the rendering is still too taxing. Can you provide some advice on how i
> can go about rendering this huge amount of data in real time?
>
> I also tried using rubberbands and they work much better but i need to
> display text attributes beside each vessel which i do not know how to
> achieve without labels. Any alternative to rendering text at specific map
> location that i can update in real time?

Custom map canvas items are perfectly suited for this type of task.
They don't require map to be re-rendered when the item gets updated.
You can subclass your own class directly from QgsMapCanvasItem or you
can create specialized class from QgsRubberBand that will additionally
draw text labels.

You can also take a look on some brief documentation for map canvas:
http://wiki.qgis.org/qgiswiki/MapCanvas_API

Martin


More information about the Qgis-developer mailing list