[Qgis-developer] why Difference takes much more time then Clip?

G. Allegri giohappy at gmail.com
Fri Jul 4 16:19:44 PDT 2014


Debuggin pointed me to the problem: a lot of EMPTY GEOMETRYCOLLECTIONS
caused QgsVectorFileWriter to write a lot of log messages. Commenting line
1718 [1] made the process run to the end in linear time.

Wouldn't be nice having an option (from the GUI) to disable logging?

giovanni

[1]
https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorfilewriter.cpp#L1718


2014-07-01 22:57 GMT+02:00 G. Allegri <giohappy at gmail.com>:

> Just two graphics two show a brutal benchmark (measuring time in every
> cycle step).
>
> Clip: http://cdn.img42.com/31e0205c1273a1d1c705e5109da48db1.png
> Difference: http://cdn.img42.com/eeba68e62ea7d4db50662c2745a6d912.png
>
>
> 2014-07-01 20:05 GMT+02:00 G. Allegri <giohappy at gmail.com>:
>
> To be correct, the two postgis queries are:
>>
>> select min(l.osm_id),st_difference(l.geom,st_union(e.geom)) as geom from
>> linee_selezione_s l join edifici_buffer_s e
>> on ST_Intersects(l.geom, e.geom) group by l.geom
>>
>> select min(l.osm_id),st_intersection(l.geom,st_union(e.geom)) as geom
>> from linee_selezione_s l join edifici_buffer_s e
>> on ST_Intersects(l.geom, e.geom) group by l.geom
>>
>>
>> 2014-07-01 19:37 GMT+02:00 G. Allegri <giohappy at gmail.com>:
>>
>> I'm doing some tests on fTools/Processing spatial operators, with a cover
>>> multilinestring layer and a base polygon layer.
>>>
>>> Running the following query on PostGIS I get similar timings with
>>> st_intersection and st_difference:
>>>
>>> select l.osm_id,ST_intersection(l.geom,e.geom) as geom from
>>> linee_selezione as l,edifici_buffer as e where ST_Intersects(l.geom, e.geom)
>>>
>>> while if I run the Difference tool QGIS chokes and it takes magnitudes
>>> of more time then Clip.
>>> If made both tools as similar as possible, just changing this [1] line
>>> of code, but the difference in execution time remains big.
>>>
>>> I can't find out where is the difference, because both PostGIS and QGIS
>>> base the operations on GEOS.
>>> Any hints?
>>>
>>> giovanni
>>>
>>> [1]
>>> https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/ftools/Clip.py#L107
>>>
>>> --
>>> Giovanni Allegri
>>> http://about.me/giovanniallegri
>>> Twitter: https://twitter.com/_giohappy_
>>> blog: http://blog.spaziogis.it
>>> GEO+ geomatica in Italia http://bit.ly/GEOplus
>>>
>>
>>
>>
>> --
>> Giovanni Allegri
>> http://about.me/giovanniallegri
>> Twitter: https://twitter.com/_giohappy_
>> blog: http://blog.spaziogis.it
>> GEO+ geomatica in Italia http://bit.ly/GEOplus
>>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> Twitter: https://twitter.com/_giohappy_
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140705/0e5f97f1/attachment.html>


More information about the Qgis-developer mailing list