Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed improvement in the render of geometries for qgis #17441

Closed
qgib opened this issue Sep 29, 2013 · 134 comments
Closed

Speed improvement in the render of geometries for qgis #17441

qgib opened this issue Sep 29, 2013 · 134 comments
Labels
Feature Request Vectors Related to general vector layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented Sep 29, 2013

Author Name: Alvaro Huarte (@ahuarte47)
Original Redmine Issue: 8725

Redmine category:vectors
Assignee: Alvaro Huarte


The render of geometries for vector layers in qgis can be optimized.
There are some tricks that sure make fast the rendering of big shapes:

  • Prefilter the points of the geometries to be painted using a map2pixel error tolerance (_getPolygon and _getLineString in rendererv2).
  • Prevents divisions in map to devices coordinates.
  • Prevents of unnecessary trim of the geometries with the canvas rect.
  • Prevents of unnecessary calloc using shared memory buffer (ogr to wkb in ogrFeatureIterator).

I have implements this tricks and qgis has better performance of 300% in some map situations.
I want validate the code and I will try share it.


@qgib
Copy link
Contributor Author

qgib commented Sep 30, 2013

Author Name: Matthias Kuhn (@m-kuhn)


Hi Alvaro,

Thank you for looking into this issues and contributing.

The best thing to do is to open a pull request on github, so it can be reviewed, commented and eventually merged.

@qgib
Copy link
Contributor Author

qgib commented Sep 30, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Ok, thank you very much

@qgib
Copy link
Contributor Author

qgib commented Sep 30, 2013

Author Name: Matthias Kuhn (@m-kuhn)


I forgot to mention that it would be best to make one pull request for each improvement. So in case one of them is not accepted, it will still be possible to merge the good parts.

@qgib
Copy link
Contributor Author

qgib commented Sep 30, 2013

Author Name: Alvaro Huarte (@ahuarte47)


ok, I will divide this issue in four single childs tasks.
Thank you!

@qgib
Copy link
Contributor Author

qgib commented Oct 4, 2013

Author Name: Giovanni Manghi (@gioman)


Hi Alvaro, do you have a branch that can be tested? Cheers!

@qgib
Copy link
Contributor Author

qgib commented Oct 4, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi Giovanni, I am testing my changes, if it successly in some days I will try a pull request.
Thank you very much!

@qgib
Copy link
Contributor Author

qgib commented Oct 5, 2013

Author Name: Alvaro Huarte (@ahuarte47)


I'm making progress, I think I get promising results. Attach a table of results for three tested layers.


  • done_ratio was changed from 0 to 70
  • 6318 was configured as test_data_qgis_master_RenderingStatsQGIS__Feature-8725.zip

@qgib
Copy link
Contributor Author

qgib commented Oct 5, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

I'm making progress, I think I get promising results. Attach a table of results for three tested layers.

wow, I can't wait to test your patches! :)

@qgib
Copy link
Contributor Author

qgib commented Oct 5, 2013

Author Name: Alvaro Huarte (@ahuarte47)


  • resolution was changed from to fixed
  • done_ratio was changed from 70 to 100
  • status_info was changed from to for test

@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

done for test.

github:
ahuarte47@28691ff
+
ahuarte47@a8894f8

Sorry there are two commits, I forgot to add one edited file

Hi Alvaro, can you please make a Pull Request in the qgis repo? This way other will be able to see it and review and then commit. Thanks!

@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Done.
I'm new using gitub and I'm learning this tool, Sorry!
Thanks!

@qgib
Copy link
Contributor Author

qgib commented Oct 7, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Changes goto branch:

https://github.com/ahuarte47/QGIS/tree/Issue_8725

@qgib
Copy link
Contributor Author

qgib commented Oct 20, 2013

Author Name: Alvaro Huarte (@ahuarte47)


I have implemented the simplification of geometries in the vector-providers. The general behavior simplifies the geometries post-fetch the feature from the provider, but OGR-provider simplifies the geometries pre-fetch the features having a extra seed improvement.

Te final result gets ~3x painting speed faster that original code

New branch:
https://github.com/ahuarte47/QGIS/tree/Issue_8725-OGR

I think ready for test! :-)


  • pull_request_patch_supplied was changed from 0 to 1
  • resolution was changed from fixed to fixed/implemented

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

I have implemented the simplification of geometries in the vector-providers. The general behavior simplifies the geometries post-fetch the feature from the provider, but OGR-provider simplifies the geometries pre-fetch the features having a extra seed improvement.

Te final result gets ~3x painting speed faster that original code

New branch:
https://github.com/ahuarte47/QGIS/tree/Issue_8725-OGR

I think ready for test! :-)

compiling right now :)

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Giovanni Manghi (@gioman)


I think ready for test! :-)

got an error during make

Building CXX object src/core/CMakeFiles/qgis_core.dir/qgsmaplayer.cpp.o
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp: In function ‘QgsRectangle calculateBoundingBox(const QVector<QPointF>&)’:
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:102:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:102:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:102:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:103:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:103:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:103:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:104:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:104:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:104:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:105:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:105:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:105:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:109:5: error: ‘x’ was not declared in this scope
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:110:5: error: ‘y’ was not declared in this scope
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp: In function ‘QgsRectangle calculateBoundingBox(QGis::WkbType, unsigned char*, std::size_t)’:
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:125:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:125:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:125:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:126:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:126:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:126:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:127:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:127:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:127:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:128:18: error: ‘numeric_limits’ is not a member of ‘std’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:128:38: error: expected primary-expression before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:128:38: error: expected ‘,’ or ‘;’ before ‘double’
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:135:5: error: ‘x’ was not declared in this scope
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:136:5: error: ‘y’ was not declared in this scope
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp: At global scope:
/home/giovanni/QGIS-Issue_8725-OGR/src/core/qgsmaprequest.cpp:149:20: warning: unused parameter ‘sourceWkb’ [-Wunused-parameter]
make[2]: [ 14%] *** [src/core/CMakeFiles/qgis_core.dir/qgsmaprequest.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Building CXX object src/core/CMakeFiles/qgis_core.dir/qgsmaplayerregistry.cpp.o
make[1]: *** [src/core/CMakeFiles/qgis_core.dir/all] Error 2
make: *** [all] Error 2

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi Giovanni, I use Visual Studio 2010 and I don't get these errors.
What compiler do you use ?

I will try fix it!

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

Hi Giovanni, I use Visual Studio 2010 and I don't get these errors.
What compiler do you use ?

I will try fix it!

Hi Alvaro, I use Ubuntu Linux, gcc 4.6.3

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Matthias Kuhn (@m-kuhn)


It's probably a simple #include <limits.h>

@qgib
Copy link
Contributor Author

qgib commented Oct 22, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Done, thanks!

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

Done, thanks!

Hi Alvaro! I made a few quick tests with shapefiles, measuring just the time to open them (with the "time" command). I have not had the time to try evaluate the improvement when zooming in/out.

The shapefiles (polygons) that I tested are:

http://faunalia.pt/downloads/GTBs_Shapefile.zip
http://faunalia.pt/downloads/MAMMTERR.zip

un-patched QGIS

giovanni@sibirica ~/Desktop $ time qgis MAMMTERR.shp

user 0m10.377s
user 0m10.237s
user 0m10.429s

giovanni@sibirica ~/Desktop $ time qgis GTBs_2011.shp

user 1m2.896s
user 1m5.436s
user 1m4.120s

patched QGIS

giovanni@sibirica ~/Desktop $ time qgis MAMMTERR.shp

user 0m6.352s
user 0m6.244s
user 0m6.820s

giovanni@sibirica ~/Desktop $ time qgis GTBs_2011.shp

user 0m35.278s
user 0m33.286s
user 0m33.602s

So there is really a substantial improvement!

I tested also another shape (big, more that 1.2gb of small polygons) where things get worst(?)

http://www.igeo.pt/scrif/crif/CRIF2011shp.zip

unpatched

giovanni@sibirica ~/Desktop $ time qgis crif2011.shp

user 0m35.186s
user 0m34.870s
user 0m35.214s

patched

giovanni@sibirica ~/Desktop $ time qgis crif2011.shp

user 0m45.571s
user 0m49.311s
user 0m46.279s

Can I test also the vectors you are using to check the rendering times?

Cheers!

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi Giovanni, Some shapes...

http://idena.navarra.es/descargas/CARTO1_Lin_6CNivelD.zip
http://idena.navarra.es/descargas/GEOLOG_Pol_Litologia.zip

I am going to test your shapes!
Thanks!

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2013

Author Name: Matthias Kuhn (@m-kuhn)


Running a rendering performance test once may be strongly biased by other processes running.
For statistically more robust numbers I recommend using @qgis_bench@

It's really simple to use.

Here some more information:
https://github.com/qgis/QGIS/blob/master/tests/bench/README

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi, I made tests with 'qgis_bench' to see the speed.

Soft/hard: +WindowsXP+SP3, 32bits, 4gb RAM+.

My shapefiles tested:

|. Dataset |. Value |. Master |. Patched | |
| http://faunalia.pt/downloads/GTBs_Shapefile.zip| iterations| 10| 10| 100% |
| | total_avg| 180.1015625| 68.8765625| 38% |
| | total_max| 185.8125| 71.484375| 38% |
| | total_maxdev| 33.3046875| 2.60781249999999| 7% |
| | total_min| 146.796875| 67.265625| 45% |
| | total_stdev| 11.1268459888756| 1.27757571479394| 11% |
| http://faunalia.pt/downloads/MAMMTERR.zip| iterations| 10| 10| 100% |
| | total_avg| 88.621875| 9.49375| 10% |
| | total_max| 95.09375| 10| 10% |
| | total_maxdev| 53.85625| 1.665625| 3% |
| | total_min| 34.765625| 7.828125| 22% |
| | total_stdev| 17.9542520316393| 0.572148158805916| 3% |
| http://www.igeo.pt/scrif/crif/CRIF2011shp.zip| iterations| 10| 10| 100% |
| | total_avg| 275.1109375| 70.275| 25% |
| | total_max| 286.5625| 71.4375| 24% |
| | total_maxdev| 93.3609375| 6.50937500000001| 6% |
| | total_min| 181.75| 63.765625| 35% |
| | total_stdev| 31.1253721504484| 2.18250769614909| 7% |
| http://idena.navarra.es/descargas/CARTO1_Lin_6CNivelD.zip| iterations| 10| 10| 100% |
| | total_avg| 8.2765625| 1.4703125| 17% |
| | total_max| 8.90625| 1.515625| 17% |
| | total_maxdev| 4.9796875| 0.1109375| 2% |
| | total_min| 3.296875| 1.359375| 41% |
| | total_stdev| 1.66037296379646| 0.0578125| 3% |
| http://idena.navarra.es/descargas/GEOLOG_Pol_Litologia.zip| iterations| 10| 10| 100% |
| | total_avg| 10.371875| 1.7953125| 17% |
| | total_max| 11.03125| 1.859375| 16% |
| | total_maxdev| 5.79375| 0.4984375| 8% |
| | total_min| 4.578125| 1.296875| 28% |
| | total_stdev| 1.93128792438492| 0.166455758480294| 8% |
| Urban parcels of cadastre of navarra (Polygon2D of 142680 records, 66mb)| iterations| 10| 10| 100% |
| | total_avg| 8.6046875| 3.3484375| 38% |
| | total_max| 9.0625| 3.375| 37% |
| | total_maxdev| 2.9953125| 0.1296875| 4% |
| | total_min| 5.609375| 3.21875| 57% |
| | total_stdev| 0.999488394520542| 0.0458481273472538| 4% |
| Rustic parcels of cadastre of navarra (Polygon2D of 542658 records, 458mb)| iterations| 10| 10| 100% |
| | total_avg| 57.8265625| 12.6921875| 21% |
| | total_max| 61.859375| 13.03125| 21% |
| | total_maxdev| 28.4671875| 0.957812499999999| 3% |
| | total_min| 29.359375| 11.734375| 39% |
| | total_stdev| 9.50177422268632| 0.32983557101418| 3% |

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Nathan Woodrow (@NathanW2)


Nice!

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Alvaro Huarte (@ahuarte47)


  • 6404 was configured as sketch.png

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

I thought a bit :-), I think more appropriate to add a new "rendering" tab with this configuration similar to global options form.

I agree

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

Hi, I made tests with 'qgis_bench' to see the speed.

Soft/hard: +WindowsXP+SP3, 32bits, 4gb RAM+.

very nice results indeed! as soon as I will understand how to use qgis_bench I will make tests too :)

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi Giovanni, qgis_bench is easy :-)

I execute in a Console Window (CMD)...

{%BIN_PATH%}/qgis_bench -i 10 -p test_project.qgs >> test_project.log

-i: number of desired iterations
-p: project to test

Regards

@qgib
Copy link
Contributor Author

qgib commented Oct 26, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

Hi Giovanni, qgis_bench is easy :-)

I execute in a Console Window (CMD)...

{%BIN_PATH%}/qgis_bench -i 10 -p test_project.qgs >> test_project.log

-i: number of desired iterations
-p: project to test

Regards

I made also tests with qgis_bench

|. Dataset |. Value |. Master |. Patched | |
| http://faunalia.pt/downloads/MAMMTERR.zip| iterations| 10| 10| 100% |
| | total_avg| 14.6881179| 3.616626| 24% |
| | total_max| 15.500969| 3.816239| 24% |
| | total_maxdev| 2.3073439| 0.204413| 8% |
| | total_min| 12.380774| 3.412213| 27% |
| | total_stdev| 0.808622095655375| 0.108486504445484| 13% |
| http://faunalia.pt/downloads/GTBs_Shapefile.zip| iterations| 10| 10| 100% |
| | total_avg| 41.0249639| 32.6264391| 79% |
| | total_max| 42.986687| 37.038314| 86% |
| | total_maxdev| 1.9617231| 4.41187489999999| 224% |
| | total_min| 39.566472| 30.029877| 75% |
| | total_stdev| 1.12526313538864| 1.95203781571303| 173% |
| http://www.igeo.pt/scrif/crif/CRIF2011shp.zip| iterations| 10| 10| 100% |
| | total_avg| 64.6020374| 37.1403211| 57% |
| | total_max| 65.808114| 38.874429| 59% |
| | total_maxdev| 4.3062684| 2.76617309999999| 64% |
| | total_min| 60.295769| 34.374148| 57% |
| | total_stdev| 1.54006099425576| 1.13227893163129| 73% |

@qgib
Copy link
Contributor Author

qgib commented Oct 26, 2013

Author Name: Jürgen Fischer (@jef-n)


  • subject was changed from Speed ​​improvement in the render of geometries for qgis to Speed improvement in the render of geometries for qgis

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Giovanni Manghi wrote:

Anyone else noticed something similar?

can you try remove the layers (one by one) from your project and see if you find one that can be the cause?

Anyone else noticed something similar?

I may have seen this (but not sure) with a specific vector layer, made of a lot of polygons that are not possible to simplify, because it is grid polygon vector made of perfect squares.

In this case seem that qgis takes a lot trying figure how simplify, eventually taking an overhead. But as I said is just an impression as I have not tested it seriously. Example

https://www.dropbox.com/s/2leh363cdbupg1w/grid25_clip.tar.gz

What you're saying makes sense, I may be trying to simplify polygons with <=5 points (grids) which themselves are not generalizable,
I look, thanks Giovanni!!

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Alvaro Huarte wrote:

Giovanni Manghi wrote:

Anyone else noticed something similar?

can you try remove the layers (one by one) from your project and see if you find one that can be the cause?

Anyone else noticed something similar?

I may have seen this (but not sure) with a specific vector layer, made of a lot of polygons that are not possible to simplify, because it is grid polygon vector made of perfect squares.

In this case seem that qgis takes a lot trying figure how simplify, eventually taking an overhead. But as I said is just an impression as I have not tested it seriously. Example

https://www.dropbox.com/s/2leh363cdbupg1w/grid25_clip.tar.gz

What you're saying makes sense, I may be trying to simplify polygons with <=5 points (grids) which themselves are not generalizable,
I look, thanks Giovanni!!

I answer to myself :-), the patch try not to simplify polygons of 5 points, or linestrings of 2 points, but try to find out if it is possible to disable the 'AntiAliasing' for render the geometry faster. If the end is not possible to disable the AA (The geometry is not so far), an overload occurs in the process.

This can be avoided disabling for this layer the drawing simplification.

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


regis Haubourg wrote:

Hi Alvaro, I tested your windows package, this is huge! Many thanks...
As a GIS administrator, I would need a general option in QGIS settings to set default behaviour and simplification level for new layers. Is that possible? We will have to deal qgs migration, could we be sure that layers coming from older QGIS will get these default QGIS settings?
Cheers
Régis

Done!

!DefaultSimplifyConfig.jpg!

Regards


  • 6500 was configured as DefaultSimplifyConfig.jpg

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


  • 6404 removed sketch.png

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi,

I release a new windows installer which contains:

http://www.filedropper.com/qgis-osgeo4w-210-f8725-setup-x86v50

I made new tests with the latest version to see the speed.

Soft/hard: WindowsXP+SP3, 32bits, 4gb RAM.

My shapefiles tested:

|. Dataset |. Value |. Master |. Patched | |
| http://faunalia.pt/downloads/GTBs_Shapefile.zip | iterations | 5 | 5 | |
| | total_avg | 214,14063 | 84,29375 | 39% |
| | total_max | 222,53125 | 85,39063 | |
| | total_maxdev | 29,60938 | 1,21563 | |
| | total_min | 184,53125 | 83,07813 | |
| | total_stdev | 14,81578 | 0,93151 | |
| http://faunalia.pt/downloads/MAMMTERR.zip | iterations | 5 | 5 | |
| | total_avg | 86,60938 | 10,60625 | 12% |
| | total_max | 98,96875 | 13,39063 | |
| | total_maxdev | 46,48438 | 2,78438 | |
| | total_min | 40,12500 | 9,81250 | |
| | total_stdev | 23,24727 | 1,39311 | |
| http://www.igeo.pt/scrif/crif/CRIF2011shp.zip | iterations | 5 | 5 | |
| | total_avg | 287,47500 | 67,36250 | 23% |
| | total_max | 307,04688 | 77,32813 | |
| | total_maxdev | 75,53750 | 9,96563 | |
| | total_min | 211,93750 | 64,78125 | |
| | total_stdev | 37,77141 | 4,98346 | |
| https://www.dropbox.com/s/2leh363cdbupg1w/grid25_clip.tar.gz | iterations | 5 | 5 | |
| | total_avg | 100,86250 | 54,27500 | 54% |
| | total_max | 101,20313 | 55,20313 | |
| | total_maxdev | 0,72187 | 2,93125 | |
| | total_min | 100,14063 | 51,34375 | |
| | total_stdev | 0,38151 | 1,46910 | |
| http://idena.navarra.es/descargas/CARTO1_Lin_6CNivelD.zip | iterations | 5 | 5 | |
| | total_avg | 7,98125 | 1,30000 | 16% |
| | total_max | 9,35938 | 2,14063 | |
| | total_maxdev | 4,30938 | 0,84063 | |
| | total_min | 3,67188 | 1,06250 | |
| | total_stdev | 2,16033 | 0,42175 | |
| http://idena.navarra.es/descargas/GEOLOG_Pol_Litologia.zip | iterations | 5 | 5 | |
| | total_avg | 9,97188 | 1,79063 | 18% |
| | total_max | 11,26563 | 2,84375 | |
| | total_maxdev | 4,95625 | 1,05313 | |
| | total_min | 5,01563 | 1,50000 | |
| | total_stdev | 2,47837 | 0,52697 | |
| Urban parcels of cadastre of navarra (Polygon2D of 142680 records, 66mb) | iterations | 5 | 5 | |
| | total_avg | 50,28438 | 10,01563 | 20% |
| | total_max | 55,93750 | 14,60938 | |
| | total_maxdev | 22,23750 | 4,59375 | |
| | total_min | 28,04688 | 8,81250 | |
| | total_stdev | 11,11898 | 2,29725 | |
| Rustic parcels of cadastre of navarra (Polygon2D of 542658 records, 458mb) | iterations | 5 | 5 | |
| | total_avg | 10,17500 | 2,65938 | 26% |
| | total_max | 11,04688 | 2,68750 | |
| | total_maxdev | 3,37813 | 0,02813 | |
| | total_min | 6,79688 | 2,64063 | |
| | total_stdev | 1,68913 | 0,01822 | |

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Nyall Dawson (@nyalldawson)


Here's some more string updates for this latest addition:

"By default simplify geometries" -> "Simplify geometries by default"

And for the text below the checkbox:

"If checked, new vector layers added to the map will automatically use geometry simplification to speed up rendering. ... (then the rest of what you have)"

Thanks!

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Nyall Dawson (@nyalldawson)


Alvaro - these improvements look fantastic! Your hard work is much appreciated!

One related idea I was planning on investigating was adding an option to disable rendering of features smaller than a certain size (in mm). You'll see a similar option in the labelling properties for a vector layer under "Rendering" -> "Suppress labelling of features smaller than ". Having the ability to skip rendering of small features could potentially lead to some more performance gains (as well as having cartographic benefits). Obviously, it should be disabled by default for layers as it would only be useful in some circumstances.

There was a bit of discussion on the QGIS dev list about this a month or so ago -- I had a quick initial attempt at implementing it but have got side tracked on composer work (and it's looking like this will tie me up for the whole of the 2.2 dev cycle).

If you wanted to experiment with this, there's code for checking the size of a feature in mm in QgsPalLayerSettings::checkMinimumSizeMM . I had a quick play here nyalldawson@27a42e1 (no gui, hard coded to a minimum size of 2mm) which yielded some benefit. This was done in QgsVectorLayer::drawRendererV2, I think moving it further up the chain could improve the performance some more.

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Nyall Dawson wrote:

Here's some more string updates for this latest addition:

"By default simplify geometries" -> "Simplify geometries by default"

And for the text below the checkbox:

"If checked, new vector layers added to the map will automatically use geometry simplification to speed up rendering. ... (then the rest of what you have)"

Thanks!

Done, thanks Nyall!

@qgib
Copy link
Contributor Author

qgib commented Nov 22, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Nyall Dawson wrote:

Alvaro - these improvements look fantastic! Your hard work is much appreciated!

One related idea I was planning on investigating was adding an option to disable rendering of features smaller than a certain size (in mm). You'll see a similar option in the labelling properties for a vector layer under "Rendering" -> "Suppress labelling of features smaller than ". Having the ability to skip rendering of small features could potentially lead to some more performance gains (as well as having cartographic benefits). Obviously, it should be disabled by default for layers as it would only be useful in some circumstances.

There was a bit of discussion on the QGIS dev list about this a month or so ago -- I had a quick initial attempt at implementing it but have got side tracked on composer work (and it's looking like this will tie me up for the whole of the 2.2 dev cycle).

If you wanted to experiment with this, there's code for checking the size of a feature in mm in QgsPalLayerSettings::checkMinimumSizeMM . I had a quick play here nyalldawson@27a42e1 (no gui, hard coded to a minimum size of 2mm) which yielded some benefit. This was done in QgsVectorLayer::drawRendererV2, I think moving it further up the chain could improve the performance some more.

Hi Nyall, I did not know this discussion!, I have involved in QGIS later. Coincidences of life, this patch proposes an implementation of that issue. Now, I'm a little waiting for comments and suggestions to see if it is interesting to approval.

On the subject of not paint "very small" elements seems like a good idea in case of layers as you mention, in other cases (very dense layers) would appear whole areas unpainted, but I would not mix this with this patch but on a new patch. If you want I can try to implement it.

Regards

@qgib
Copy link
Contributor Author

qgib commented Nov 22, 2013

Author Name: Nyall Dawson (@nyalldawson)


Alvaro Huarte wrote:

Hi Nyall, I did not know this discussion!, I have involved in QGIS later. Coincidences of life, this patch proposes an implementation of that issue. Now, I'm a little waiting for comments and suggestions to see if it is interesting to approval.

I know - it's great timing! Thanks for all the work you've put in developing these much needed improvements for QGIS.

On the subject of not paint "very small" elements seems like a good idea in case of layers as you mention, in other cases (very dense layers) would appear whole areas unpainted, but I would not mix this with this patch but on a new patch. If you want I can try to implement it.

I don't want to add to your workload, but it'd be great if you could check it out. I've realized I'm not going to get a chance to tackle this for 2.2. Based on your past work you've got a much better understanding of optimising code like this then I do!

@qgib
Copy link
Contributor Author

qgib commented Nov 22, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Nyall Dawson wrote:

Alvaro Huarte wrote:

Hi Nyall, I did not know this discussion!, I have involved in QGIS later. Coincidences of life, this patch proposes an implementation of that issue. Now, I'm a little waiting for comments and suggestions to see if it is interesting to approval.

I know - it's great timing! Thanks for all the work you've put in developing these much needed improvements for QGIS.

On the subject of not paint "very small" elements seems like a good idea in case of layers as you mention, in other cases (very dense layers) would appear whole areas unpainted, but I would not mix this with this patch but on a new patch. If you want I can try to implement it.

I don't want to add to your workload, but it'd be great if you could check it out. I've realized I'm not going to get a chance to tackle this for 2.2. Based on your past work you've got a much better understanding of optimising code like this then I do!

Thanks Nyall, I also really appreciate the tests, advice and opinions of the community, they serve me to keep learning every day. And your english corrections ;-)

@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2013

Author Name: Jeremy Palmer (@palmerj)


I've just seen this pull request. Dumb question, but why would you implement the user defined
simplification setting? Seems to me it should be sorted by the software automatically, based on extent and the map to pixel setting. Is also overly complicated for the user...

@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Jeremy Palmer wrote:

I've just seen this pull request. Dumb question, but why would you implement the user defined
simplification setting? Seems to me it should be sorted by the software automatically, based on extent and the map to pixel setting. Is also overly complicated for the user...

Hi Jeremy, the software automatically calculates the simplification factor based on geometry and current map2pixel setting (Slider with minimum value).

I added the possibility of increase this factor to get 'extra' simplification to accelerate even more the render of very large layers.
In this case it is possible that appear gaps and one warning message is showed in the configuration panel.

As I said above the user, in most cases, do not worry about modifying this value, but in other cases it may be interesting.
Regards

@qgib
Copy link
Contributor Author

qgib commented Dec 8, 2013

Author Name: Jeremy Palmer (@palmerj)


Hi Alvaro,

Thanks for the reply. In that case it might be worth stating on the slider label that it is a advanced experimental option.

Cheers,
Jeremy

@qgib
Copy link
Contributor Author

qgib commented Dec 8, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Jeremy Palmer wrote:

Hi Alvaro,

Thanks for the reply. In that case it might be worth stating on the slider label that it is a advanced experimental option.

Cheers,
Jeremy

Hi Jeremy, I suppose we should add an entry in the user manual and explain this configuration.
Thanks!

Alvaro

@qgib
Copy link
Contributor Author

qgib commented Dec 12, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi all, There is a modification in behavior of this patch (#980).

Now, it contains the advise of @nyalldawson (#1020 (comment)) to enable AA-disabling only when the simplification slider is greater than minimum value.

Best regards

@qgib
Copy link
Contributor Author

qgib commented Dec 13, 2013

Author Name: Alvaro Huarte (@ahuarte47)


  • 6573 was configured as BadSimplificationWithOffset.jpg

@qgib
Copy link
Contributor Author

qgib commented Dec 17, 2013

Author Name: Alvaro Huarte (@ahuarte47)


I am pleased to announce that this patch seems to have been merged!
:-)

Thank you very much for your support and advices!

@qgib
Copy link
Contributor Author

qgib commented Dec 17, 2013

Author Name: Giovanni Manghi (@gioman)


Alvaro Huarte wrote:

I am pleased to announce that this patch seems to have been merged!
:-)

Thank you very much for your support and advices!

Alvaro, many thanks to YOU :)

@qgib
Copy link
Contributor Author

qgib commented Dec 17, 2013

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Open to Closed
  • resolution was changed from to fixed/implemented

@qgib
Copy link
Contributor Author

qgib commented Dec 17, 2013

Author Name: Alvaro Huarte (@ahuarte47)


What about add documentation to user manual?

@qgib
Copy link
Contributor Author

qgib commented Dec 17, 2013

Author Name: Jürgen Fischer (@jef-n)


merged in 17cd09a

@qgib
Copy link
Contributor Author

qgib commented Dec 26, 2013

Author Name: Alvaro Huarte (@ahuarte47)


Hi, I committed a new version of geometry simplification to speed up the vector drawing.
https://github.com/ahuarte47/QGIS/tree/Issue_8725-revival-optA-to-B

It is inspired in this PR, but it contains several changes based on advice received ( @Matthias-Kuhn thanks! ) and new features:

  • About code, the simplification is configured in a new QgsSimplifyMethod class which indicates how to simplify the geometries in a feature iterator.
  • Now, the user can define where the simplification executes (There is a new option in settings panel), locally after fetch the geometry from provider, or simplifying it on provider side. e.g. In postgres provider, first option simplifies the geometry already fetched locally, but the second option simplifies the geometry in database using the function ST_Simplify.
  • The settings panel also shows the simplification threshold in pixel units as @timlinux suggested me.

I have not created a new pull request because of I would greatly appreciate if you could test it with your data and SO's. I have tested it in windows I get similar results as old version for shapefiles (OGR-provider). The new simplification on database side for postgres provider improves the old results too. I will create a table of tests to compare data and configurations.

About postgres simplification, the ST_simplify function needs a tolerance parameter, I use map2pixel/5.0 as input value, it is experimental and I must define it better (All ideas are welcome). This simplification can be applicable to other database providers (MySQL, SQL Server, Oracle...)

Thank you very much!

@qgib qgib added Feature Request Vectors Related to general vector layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Future Release - Nice to have milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
JamesShaeffer pushed a commit to JamesShaeffer/QGIS that referenced this issue Nov 20, 2019
The autogenerated ids are quite long and this leads that they where very unconfortable to use in the configuration of relation reference in the attribute type widget of layer properties - attribute form. So now the names are used in the combo instead of the ids. This effects only the GUI.

Fix: qgis#17441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant