[Qgis-developer] My first QGIS plugin

Martin Dobias wonder.sk at gmail.com
Thu Nov 24 08:30:12 EST 2011


On Thu, Nov 24, 2011 at 10:21 AM, aruntheguy at gmail.com
<aruntheguy at gmail.com> wrote:
>>
>> it would be nice if it can import directly the downloaded csv files
>
> I specifically left that import to be done manually, so that I don't
> reinvent the wheel of CSV import, which is effectively handled by the
> delimited text import plugin. Moreover the user gets to know where the data
> file is stored and select them later. If imported directly, they might
> download it multiple times (just my assumption :P)

You do not need to reinvent the wheel in order to load a delimited
text layer. You can easily load the data automatically with delimited
text provider, this is a snippet from PyQGIS cookbook:

uri = "/some/path/file.csv?delimiter=%s&xField=%s&yField=%s" % (";", "x", "y")
vlayer = QgsVectorLayer(uri, "layer_name_you_like", "delimitedtext")

At least it could be an option - a checkbox for automatic import would help.

Martin


More information about the Qgis-developer mailing list