[Qgis-developer] Python CSV Plugin

Martin Dobias wonder.sk at gmail.com
Wed Dec 29 04:47:09 EST 2010


On Wed, Dec 29, 2010 at 8:11 AM, jude mwenda <judemwenda at gmail.com> wrote:
> Hi all,
>
> I have been building a plugin and reached a dead end. I am parsing the csv
> resource into a variable. but according to the qgis documentation, the
> resource has to be a file. Can it be a variable. the code section that has
> this issue is
>     results = ft_client.query(SQL().select(371443,None,None))
>
>     uri = results."?delimiter=%s&xField=%s&yField=%s" % (",", "Address",
> "LONGITUDE")
>     vlayer = QgsVectorLayer(uri, "layer_name_you_like", "delimitedtext")
> there is something very wrong with the uri section of the code. the docs
> just use file paths, what of a variable as is my case? How would i go about
> loading this. Please help

Jude,

you have to save the contents of your variable to a temporary file and
then load that file as a vector layer.

Martin


More information about the Qgis-developer mailing list