Hi list !<br>I'm developping a QGIS plugin using Python Bindings<br>I recently managed to automatically create a shp layer from a csv file using this code<br>**************************************************************************************************************************************************
<span style="color: rgb(102, 102, 102); font-style: italic;"><br>uri = "C:\G77\driftx_multi_level\txtfile.csv?delimiter=%s&xField=%s&yField=%s" % (";", "x", "y")<br>vlayer = QgsVectorLayer(uri, "vectorial puff", "delimitedtext")
<br>error = QgsVectorFileWriter.writeAsShapefile(vlayer, "python/plugins/DriftxPlugin/data/vectorial_puff.shp", "CP1360")<br><br>if error == QgsVectorFileWriter.NoError:QgsMapLayerRegistry.instance().addMapLayer(vlayer)QMessageBox.warning(
self.iface.getMainWindow(), self.MSG_BOX_TITLE, ("shapefile created !"), QMessageBox.Ok, QMessageBox.Ok)<br>else:</span><br style="font-style: italic;"><span style="font-style: italic;">QMessageBox.warning(self.iface.getMainWindow
(), self.MSG_BOX_TITLE, ("Error creating your shapefile\n"),
QMessageBox.Ok, QMessageBox.Ok)<br><br></span>******************************************************************************************************************************************************<br>The code works but i still have the following error message just before the created shp loads
" Note: the following lines were not loaded because Qgis was unable to determine values for the x and y coordinates:"<br>I don't understand why. Any ideas ??<br><br>As you can see in the code, i create the shp in a data folder in my plugin directory.
<br>The main problem is if i use my plugin again, the shp doesn't want to be created again because it already exists in the data folder.<br>I'd like to destroy the previous existing folder every time the VectorFileWriter is launched.
How can i do that ?<br><br>Finally, i'd like to apply symbology properties (graduated colors, field to use, number of classes...) on the loaded shp.<br>Is there a Qgs class to do this ?<br><br>Thanks 4 answers.<br><br>
Nick BOZON <br>