[Qgis-developer] QGIS Engine development

Martin Dobias wonder.sk at gmail.com
Tue Nov 27 12:42:07 PST 2012


let me share some thoughts...

On Wed, Nov 21, 2012 at 3:34 PM, Mihis <mihis.sakh at gmail.com> wrote:

> Marco Hugentobler-4 wrote
> > I don't know if AGG would be faster than the Qt raster paint engine and
> > how much. It would be very interesting to have the comparison AGG <-> Qt
> > raster engine (and maybe libcairo as well).
> >
> > With AGG / cairo, the approach would be to create a new Qt paint engine
> > based on these libs (rather than changing the code in qgis core to be Qt
> > free). If someone knows of an AGG paint engine implementation or likes
> > to create one, that would be very interesting.
> There is point of view (which I consider to be right) that implementation
> of
> traditional
> painting engine (like one in Qt, Cairo, GDI+) with one large Painter class
> on the top of
> AGG is totally inefficient because of the template architecture of this
> library. Maybe much
> more efficient approach will be implementation of light weighted wrapper of
> AGG, which will
> look like a system of classes for optimized rendering of spatial data.

It's hard to discuss AGG vs Qt rendering performance without benchmarks on
real data. As far as I know, Qt has fairly optimized rendering, see:

http://doc.qt.digia.com/qt/qpainter.html - Performance section

> However the absolute majority
> of cases when you need really fast spatial data rendering is when you need
> to display set of
> large vector layers like rivers, lakes, elevation contours, coastline and
> so
> on. Such kind of features
> in cartography are expected to be displayed on the map by identical
> graphics
> symbols (lines of the same width and color, polygons withe same outline and
> the same fill color and so on).
> In such situation the most efficient approach is to minimize the number of
> calls of rasterisation
> algorithm (rasterize all identical graphics symbols at a time). This
> definitely can be easily implemented
> with the help of AGG. And what about Qt? I can mistake but it seems to me
> that such classes
> as QPainter are often hardcoded things (Cairo's painter class is
> hardcoded).
> So does Qt painting engine
> have enough potential for optimized usage to be used for efficient spatial
> data rendering?

Qt has modular painting system, so you could try give it a try and
implement a paint engine based on AGG, but I do not believe that would make
a difference - there are other areas that need more attention.

> However in my opinion (but I may mistake) rendering of spatial data is not
> the main issue
> in the terms of QGIS performance problem. It seems that main problem lies
> in
> usage of GDAL/OGR,
> which tendency to support great number of vector and raster data formats
> may
> have negative influence
> on its performance. Of course, it's possible to give users opportunity to
> switch to another memory usage model (store all data in memory),
> furthermore
> as I know QGIS Engine already has implementation of such technique for
> vector data (QgsMemoryProvider). That will lead to significant improvement
> of performance,
> but in my opinion to make QGIS be competitive with proprietary GIS systems,
> fast spatial data rendering system with efficient memory usage should be
> implemented. So, are there any ideas about implementation of own QGIS
> spatial data formats, or other possible ways to speed up process of reading
> data from files?

Currently I see the greatest bottleneck in access to data. First of all, we
do not have in-memory caching, so the data are fetched from data source
everytime we render a map. Efficiency of GDAL/OGR could also be improved in
some cases, but it really depends on what data format you are going to use.
Apart from GDAL/OGR, QGIS has native data providers for PostGIS, SpatiaLite
and other sources which is supposed to give us more flexibility, faster
access and better control since there is one layer less.

I have been measuring the performance of vector layer rendering some time
ago and it varies greatly on three levels:
- data source type (shapefile / database layer / ...)
- layer type (geometry type, number of vertices per geometry, number of
attributes, ...)
- renderer type (using attributes? antialiasing? thick lines?)

Of course there are some areas worth improving also in QGIS to lower the
amount of time spent in QGIS libraries while rendering and to make life
easier to the rendering engine (e.g. simplify polygons with lots of
vertices before rendering them).

I apologize in advance for my posts, because they may sound like criticism
> of QGIS. Indeed I haven't used QGIS much. I work in commercial company,
> which is planning to build its own GIS system only for internal work. The
> key problem is that this system must be able to work fast with really large
> raster and vector files. My boss doesn't want the system to be created from
> scratch, he wants me to use some open source GIS platform. That's why I am
> very interested in the real temps of QGIS Engine development, who and how
> many developers really work on these problems? I also have investigated
> situation around more fast gvSIG, but it is Java-based and unlike QGIS
> seems
> not to have API for development of standalone GIS applications.

Building an own GIS system on top of QGIS is something that is perfectly
possible and may result in fruitful cooperation: your company can save
large amount of money that would be spent on initial development and may
focus just to specific areas important for your company.

> Also I would not pay attention for QGIS performance problems if I hadn't
> keep in mind an example of one university experimental GIS development
> project. It resulted in the development by one person of simple GIS
> application with own vector data format and AGG based rendering, without
> some complex systems of data caching or tricky techniques of reading data
> from files, without thread support, built with old Borland С++ compiler.
> Some time ago I tested it and was really surprised to find that it worked a
> bit slower the multithreaded gvSIG and much faster then QGIS.

We would be very happy to see any patches that would improve the
performance :-)

> I apologize for my post again, I have no aim to criticize QGIS. I believe
> it
> to have great potential in improving of performance. I am only trying to
> investigate the real situation. Are there real detailed
> plans for improvement of QGIS Engine?

I'm currently working on getting some changes in libraries done in
preparation for version 2.0 which hopefully will bring also rendering in
threads (I have worked on that during GSoC 2010, but did not get it
merged). See my reports from GSoC:


Otherwise, there are no detailed plans for improvements of rendering speed
- I encourage you to give QGIS a try, evaluate where the speed is lacking
your needs and tell us your findings - you could even find some sponsors
willing to invest money into some performance improvements (or share the
development costs)!

> And what are the real opportunities of
> QGIS community to implement these plans in program codes?

Of course everyone is welcome to suggest improvements and provide patches,
so there are lots of opportunities. QGIS core team is receptive to patches
from other community members. When starting a greater development that
should be merged to QGIS source code, it is a good idea to let the team
know - we can help with design decisions and it also lowers the probability
that more people work independently on the same thing.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20121127/10e0d9a8/attachment.html>

More information about the Qgis-developer mailing list