Hi,<br><br>I'm preparing a QGIS demo for tomorrow's italian Linux Day meeting and I'm hitting an error with Ftools->buffering.<br>
<br>Basically, I'm building a 20 m buffer around a selected linestring (first I select one geometry from a postgis vector layer, but I get the same result if the selected geometry comes from a sqlite file), I'm saving the buffer in /home/me/tmp/buf.shp, the plugin says :<br>
<br>
<p style="margin: 0px; text-indent: 0px;">Shapefile in ouput creato:</p>
<p style="margin: 0px; text-indent: 0px;">/home/me/tmp/buf.shp</p><br>but the file is not there (and this is a bug: the message shouldn't say the the file has been created when it is not), adding to the legend throws an error since the file does not exists and cannot be loaded.<br>
<br>The problem originates from QGIS shapefile writer which cannot resolve conflicts between field names (which are truncated at 8 chars or so AFAIK).<br><br>I soved hacking the ftools plugin code <br><br>$ diff tmp/ftool.mod /usr/share/qgis/python/plugins/fTools/tools/doGeoprocessing.py<br>
297,298d296<br>< # ABP:<br>< fields = { 0 : fields[0] }<br><br>a couple of thoughts:<br><br>1 - fTools (or <a class="el" href="http://doc.qgis.org/stable/classQgsVectorFileWriter.html#2353ce27918c2f711dba97f1d6b96a23">QgsVectorFileWriter</a> ?) should better handle errors when shapefile conversion - save fails<br>
2 - an option to save buffer and other results to temporary in-memory layer should be provided<br>3 - is it really necessary to copy all source vector fields in the result file ? Not in the buffer function, maybe in the other tools ?<br>
4 - the docs say QgsFileWriter will support other output formats, is there a roadmap for this feature ? This could eventually solve many conversion errors due to shapefile (DBF) limitations<br>5 - it's not clear to me how to catch QgsFileWriter errors from python code while delegating real writing to the destructor (see: "del writer" in the plugin's code), this could solve point 1 in this list<br>
<br><br>-- <br>Alessandro Pasotti<br>w3: <a href="http://www.itopen.it" target="_blank">www.itopen.it</a><br>