[Qgis-developer] VectorFileWriter works properly

PikoBoZ piklas at gmail.com
Wed Nov 28 05:29:46 EST 2007


Hi all !!
First many thanks to Tim and Garry for previous answers
I had the same bug with the vectorfilewriter (QGIS was crashing), as
kimaidou had
It works fine now, by linking renderer and symbols, as Garry suggested
code:
**************************************************************
uri =
"python\plugins\DriftxPlugin\data\file.csv?delimiter=%s&xField=%s&yField=%s"
% (";", "latitude", "longitude")
	vlayer = QgsVectorLayer(uri, "vectorial plume", "delimitedtext")
	error = QgsVectorFileWriter.writeAsShapefile(vlayer,
"python/plugins/DriftxPlugin/data/vectorial_puff.shp", "CP1360")
	
	if error == QgsVectorFileWriter.NoError:
		QgsMapLayerRegistry.instance().addMapLayer(vlayer)
		
		r=QgsContinuousColorRenderer(vlayer.vectorType())
		r.smin=QgsSymbol(vlayer.vectorType(), "0","","")
		r.smax=QgsSymbol(vlayer.vectorType(), "1","","")
		r.smin.setPen(QPen(Qt.green, 1.0))
		r.smax.setPen(QPen(Qt.red, 1.0))
		r.setMinimumSymbol(r.smin)
		r.setMaximumSymbol(r.smax)
		r.setClassificationField(3)
	
		vlayer.setRenderer(r)
**************************************************************
I'm now going to use os python for overwritting the created shp

Bye
PikObOz
-- 
View this message in context: http://www.nabble.com/VectorFileWriter-works-properly-tf4887608.html#a13989617
Sent from the qgis-developer mailing list archive at Nabble.com.




More information about the Qgis-developer mailing list