<div dir="ltr">(I changed the topic)<div><br></div><div>Geometry collections in QGIS must be treated at the GEOS level. </div><div>There isnt a QGIS::wkbType for geometry collections, so if GEOS return a collection they must be managed as GEOS geometries, before "moving them up" to QgsGeometry.</div>
<div><br></div><div>Correct me if I'm wrong.</div><div><br></div><div>giovanni<br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-05 17:17 GMT+02:00 Andrea Peri <span dir="ltr"><<a href="mailto:aperi2007@gmail.com" target="_blank">aperi2007@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thx GioHappy, this is imprtant for me to know.<br>
<br>
So is surely better to use the postgis or spatialite<br>
because it allow you to extract from the collection the section with<br>
the right type.<br>
<br>
If you do a difference beetwen two polygons is the result is a<br>
collection with a polygon section and a point section.<br>
You should extract the polygon and discard the point.<br>
If the strategu is discard all the collection this mean that on qgis<br>
the difference could lost domething of important and so potentially<br>
the difference do a wrong result.<br>
<br>
Regards,<br>
Andrea.<br>
<br>
<br>
2014-07-05 16:47 GMT+02:00 G. Allegri <<a href="mailto:giohappy@gmail.com">giohappy@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> AFAICS whenever a new feature needs to be created, geom collections are<br>
> discarded, because QGIS cannot manage them.<br>
><br>
> giovanni<br>
><br>
><br>
> 2014-07-05 16:40 GMT+02:00 Andrea Peri <<a href="mailto:aperi2007@gmail.com">aperi2007@gmail.com</a>>:<br>
><br>
>> Ok, sorry.<br>
>><br>
>> Just a my personal curiosity:<br>
>> The difference could give also a collection not empty.<br>
>> If the difference of two polygons is a collection with some polygons,<br>
>> some lines and some points.<br>
>> What happened to this collection in QGIS ?<br>
>><br>
>> Thx,<br>
>> A.<br>
>><br>
>><br>
>> 2014-07-05 16:03 GMT+02:00 G. Allegri <<a href="mailto:giohappy@gmail.com">giohappy@gmail.com</a>>:<br>
>> > Hi Andrea, as I said above I'm not considering it an error.<br>
>> > The topic of this post is QGIS message logging.<br>
>> > The processing completes as expected, with the same results as<br>
>> > Spatialite<br>
>> > and PostGIS. These simply do it silently :)<br>
>> ><br>
>> > giovanni<br>
>> ><br>
>> ><br>
>> ><br>
>> > 2014-07-05 15:59 GMT+02:00 Andrea Peri <<a href="mailto:aperi2007@gmail.com">aperi2007@gmail.com</a>>:<br>
>> ><br>
>> >> Hi GioHappy,<br>
>> >><br>
>> >> the empty-collection is absolutelly not necessarylly a bug.<br>
>> >> It is the obviously result of an operation on a machine (like the<br>
>> >> computer) with a binary finite arithmetic.<br>
>> >><br>
>> >> Usually the empty is due to a too low value to be describe with a<br>
>> >> finite binary arithmetic.<br>
>> >><br>
>> >> If the dataset is small or it is topologically correct (this not mean<br>
>> >> only to be snapped).<br>
>> >>  the collection results never happened.<br>
>> >> Instead if the dataset is not topologically correct and is big the<br>
>> >> probability to have some collection result grow.<br>
>> >> We tipically have alway an 0.01% of collection on our results.<br>
>> >><br>
>> >> I suggest you to use directly postgis or spatialite to do this kind of<br>
>> >> operations.<br>
>> >><br>
>> >> In these products you have the useful tools to resolve the collections<br>
>> >> correctly.<br>
>> >><br>
>> >> Regard,<br>
>> >><br>
>> >> Andrea.<br>
>> >><br>
>> >><br>
>> >> 2014-07-05 12:40 GMT+02:00 G. Allegri <<a href="mailto:giohappy@gmail.com">giohappy@gmail.com</a>>:<br>
>> >> > Hi Jurgen,<br>
>> >> > I wouldn't call them errors. GEOSDIfference returned a lot of empty<br>
>> >> > geomcollections, which the QgsVectorFileWriter couldn't manage.<br>
>> >> > Consequently<br>
>> >> > it wrote a log message for each geometry it couldn't write [1].<br>
>> >> ><br>
>> >> > Surely the logging should be improved in this specific case. Anyway,<br>
>> >> > I<br>
>> >> > think<br>
>> >> > the option to turn QgsMessageLog off could be useful anyway...<br>
>> >> ><br>
>> >> > giovanni<br>
>> >> ><br>
>> >> > [1]<br>
>> >> ><br>
>> >> ><br>
>> >> > <a href="https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorfilewriter.cpp#L1718" target="_blank">https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorfilewriter.cpp#L1718</a><br>
>> >> ><br>
>> >> ><br>
>> >> > 2014-07-05 12:31 GMT+02:00 Jürgen E. <<a href="mailto:jef@norbit.de">jef@norbit.de</a>>:<br>
>> >> ><br>
>> >> >> Hi Giovanni,<br>
>> >> >><br>
>> >> >> On Sat, 05. Jul 2014 at 10:27:24 +0200, G. Allegri wrote:<br>
>> >> >> > As I reported in a previous post, I was unable to conclude a<br>
>> >> >> > difference<br>
>> >> >> > operation on a vector because the tool was running in exponential<br>
>> >> >> > time.<br>
>> >> >><br>
>> >> >> > Debugging pointed me to the problem: QgsVectoFileWriter was<br>
>> >> >> > logging<br>
>> >> >> > tons<br>
>> >> >> > of<br>
>> >> >> > empty geometres with an incompatible type which will be discarded.<br>
>> >> >> > After commenting the line of logging the process completed in<br>
>> >> >> > linear<br>
>> >> >> > time.<br>
>> >> >><br>
>> >> >> > Shouldn't we offer the opportunity to turn QgsLogger off? This<br>
>> >> >> > would<br>
>> >> >> > let<br>
>> >> >> > the user/developer to switch it off whenever he already knows<br>
>> >> >> > what's<br>
>> >> >> > happening.<br>
>> >> >> > Is it already there and I missed it?<br>
>> >> >><br>
>> >> >> What error message did you get and wouldn't it be better to kill<br>
>> >> >> them<br>
>> >> >> where it<br>
>> >> >> origins or to issue a final "%n empty geometries skipped" instead of<br>
>> >> >> logging<br>
>> >> >> individual errors.<br>
>> >> >><br>
>> >> >> Alternatively we could issue a "last message repeated %n times" in<br>
>> >> >> message<br>
>> >> >> log<br>
>> >> >> to make it behave better - although that only works the error<br>
>> >> >> message<br>
>> >> >> are<br>
>> >> >> identical.<br>
>> >> >><br>
>> >> >><br>
>> >> >> Jürgen<br>
>> >> >><br>
>> >> >> --<br>
>> >> >> Jürgen E. Fischer           norBIT GmbH             Tel.<br>
>> >> >> +49-4931-918175-31<br>
>> >> >> Dipl.-Inf. (FH)             Rheinstraße 13          Fax.<br>
>> >> >> +49-4931-918175-50<br>
>> >> >> Software Engineer           D-26506 Norden<br>
>> >> >> <a href="http://www.norbit.de" target="_blank">http://www.norbit.de</a><br>
>> >> >> QGIS release manager (PSC)  Germany                    IRC: jef on<br>
>> >> >> FreeNode<br>
>> >> >><br>
>> >> >> --<br>
>> >> >> norBIT Gesellschaft fuer Unternehmensberatung und<br>
>> >> >> Informationssysteme<br>
>> >> >> mbH<br>
>> >> >> Rheinstrasse 13, 26506 Norden<br>
>> >> >> GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502<br>
>> >> >><br>
>> >> >> _______________________________________________<br>
>> >> >> Qgis-developer mailing list<br>
>> >> >> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>> >> >> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > --<br>
>> >> > Giovanni Allegri<br>
>> >> > <a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><br>
>> >> > Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a><br>
>> >> > blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>
>> >> > GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a><br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > Qgis-developer mailing list<br>
>> >> > <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>> >> > <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>> >><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> -----------------<br>
>> >> Andrea Peri<br>
>> >> . . . . . . . . .<br>
>> >> qwerty àèìòù<br>
>> >> -----------------<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Giovanni Allegri<br>
>> > <a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><br>
>> > Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a><br>
>> > blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>
>> > GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> -----------------<br>
>> Andrea Peri<br>
>> . . . . . . . . .<br>
>> qwerty àèìòù<br>
>> -----------------<br>
><br>
><br>
><br>
><br>
> --<br>
> Giovanni Allegri<br>
> <a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><br>
> Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a><br>
> blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>
> GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a><br>
<br>
<br>
<br>
--<br>
-----------------<br>
Andrea Peri<br>
. . . . . . . . .<br>
qwerty àèìòù<br>
-----------------<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><div>Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div>
<div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div>
</div></div></div>