[Qgis-developer] Python script about 'Add delimited text'
Jiaqiu Wang
jiaqiuwang at gmail.com
Tue May 14 03:38:47 PDT 2013
Hello,
I read some posts about how to import 'delimited text' using plugin in
QGIS.
I have plenty of .csv files to cope with. Do you know how to cope with it
using python script ? Thank you very much for the help !
Best wishes,
Dr Jiaqiu
Research Associate
UCL Centre for Advanced Spatial Analysis
1st Floor, 90 Tottenham Court Rd
London, W1T 4TJ
Tel: +44 (0)7907 810269
www.casa.ucl.ac.uk
On 14/05/2013 11:22, "qgis-developer-request at lists.osgeo.org"
<qgis-developer-request at lists.osgeo.org> wrote:
>Send Qgis-developer mailing list submissions to
> qgis-developer at lists.osgeo.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>or, via email, send a message with subject or body 'help' to
> qgis-developer-request at lists.osgeo.org
>
>You can reach the person managing the list at
> qgis-developer-owner at lists.osgeo.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Qgis-developer digest..."
>
>
>Today's Topics:
>
> 1. Re: Adding labels (Beno?t Laurent)
> 2. Raster drawing style always set to single band gray
> (Alexander Bruy)
> 3. Re: Adding labels (Larry Shaffer)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Tue, 14 May 2013 11:18:27 +0200
>From: Beno?t Laurent <blaurent at heurisis.eu>
>To: qgis-developer at lists.osgeo.org
>Subject: Re: [Qgis-developer] Adding labels
>Message-ID: <51920163.7090005 at heurisis.eu>
>Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
>Hello,
>
>Did I ask my question in the right place ? Can someone help me ? Thank
>you in advance.
>
>Regards,
>
>Beno?t
>
>
>> Hello,
>>
>> I am not sure to be on the right place to ask my question. If not, I
>> beg your pardon.
>>
>> I am trying the write a Python script that :
>> - load a set of shapefile ;
>> - automatically add labels based on a field ;
>> - set the color, the size, etc. of my points.
>>
>> For the moment, I can load the shapefiles. I also succeded in labeling
>> but I am not able to move the labels manually once created. Here is my
>> piece of code for labeling :
>> def add_label(self, layer):
>> layer.enableLabels(1)
>> myLabel = layer.label()
>> myLabel.setLabelField( QgsLabel.Text, 17)
>> myLabel.layerAttributes().setAlignment(4)
>>
>> Is there an other way of doing this ? Is there samples of code ?
>>
>> Thank you in advance.
>>
>> Beno?t
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>--
>Signature_Benoit_Laurent
>Heurisis <http://www.heurisis.eu>
>
>
>Beno?t LAURENT Consultant Optimisation
>
>9, rue Alexandre Fleming, 49066 Angers CEDEX
>
>Portable +33 (0)6 28 03 81 32 e-mail : blaurent at heurisis.eu
><mailto:blaurent at heurisis.eu>
>tel : +33 (0)9 54 30 41 14 site : www.heurisis.eu
><http://www.heurisis.eu/>
>
>
> Visitez le site www.optiscolaire.fr <http://www.optiscolaire.fr>
>
>?co : Avant d'imprimer ce mail, pensez ? l'environnement
>
>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0001.html>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: heurisis-small.jpg
>Type: image/jpeg
>Size: 5048 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0001.jpg>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: portable.gif
>Type: image/gif
>Size: 895 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0005.gif>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: icon_mail.gif
>Type: image/gif
>Size: 882 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0006.gif>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: icon_tel.gif
>Type: image/gif
>Size: 873 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0007.gif>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: icon_terre.gif
>Type: image/gif
>Size: 883 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0008.gif>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: icon_eco.gif
>Type: image/gif
>Size: 468 bytes
>Desc: not available
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/869b
>d56d/attachment-0009.gif>
>
>------------------------------
>
>Message: 2
>Date: Tue, 14 May 2013 13:34:05 +0400
>From: Alexander Bruy <alexander.bruy at gmail.com>
>To: qgis-developer <qgis-developer at lists.osgeo.org>
>Subject: [Qgis-developer] Raster drawing style always set to single
> band gray
>Message-ID: <20130514133405.cf7f0717f216c29fc5484b1f at gmail.com>
>Content-Type: text/plain; charset=US-ASCII
>
>Hi all,
>
>seems something broken in raster subsystem. Method drawingStyle() of
>QgsRasterLayer class always returns 1 despite which rendering style
>is set via properties or qml file.
>
>Steps to reproduce:
> 1. load singleband gray raster
> 2. open layer properties and in Style tab set "Render type" to
> Singleband pseudocolor
> 3. add several classes and assign colors for them, apply changes
> 4. close layer properties
> 5. open Python console and run next code (raster layer should be
> active):
>
> l = iface.mapCanvas().currentLayer()
> l.drawingStyle()
>
>This always returns value 1, but for Singleband pseudocolor it
>must be 2.
>
>Should I file ticket?
>
>--
>Alexander Bruy
>
>
>------------------------------
>
>Message: 3
>Date: Tue, 14 May 2013 04:22:07 -0600
>From: Larry Shaffer <larrys at dakotacarto.com>
>To: Beno?t Laurent <blaurent at heurisis.eu>
>Cc: QGIS Developer List <qgis-developer at lists.osgeo.org>
>Subject: Re: [Qgis-developer] Adding labels
>Message-ID:
> <CA+nQOR_Qva-AuZt3j=5SCaGjy+bS9yP1ATa_SzW_7VSHFVbG9A at mail.gmail.com>
>Content-Type: text/plain; charset="windows-1252"
>
>Hi Beno?t ,
>
>On Tue, May 14, 2013 at 3:18 AM, Beno?t Laurent
><blaurent at heurisis.eu>wrote:
>
>> Hello,
>>
>> Did I ask my question in the right place ? Can someone help me ? Thank
>>you
>> in advance.
>>
>
>If you are using a master branch build, you can script the new labeling
>engine via Python. The following test script has some sample code [1].
>
>[1]
>https://github.com/qgis/Quantum-GIS/blob/master/tests/src/python/test_qgsp
>allabeling.py
>
>Regards,
>
>Larry
>
>
>> Regards,
>>
>> Beno?t
>>
>>
>> Hello,
>>
>> I am not sure to be on the right place to ask my question. If not, I beg
>> your pardon.
>>
>> I am trying the write a Python script that :
>> - load a set of shapefile ;
>> - automatically add labels based on a field ;
>> - set the color, the size, etc. of my points.
>>
>> For the moment, I can load the shapefiles. I also succeded in labeling
>>but
>> I am not able to move the labels manually once created. Here is my
>>piece of
>> code for labeling :
>> def add_label(self, layer):
>> layer.enableLabels(1)
>> myLabel = layer.label()
>> myLabel.setLabelField( QgsLabel.Text, 17)
>> myLabel.layerAttributes().setAlignment(4)
>>
>> Is there an other way of doing this ? Is there samples of code ?
>>
>> Thank you in advance.
>>
>> Beno?t
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>> --
>> [image: Heurisis] <http://www.heurisis.eu>
>>
>> Beno?t LAURENT Consultant Optimisation
>> 9, rue Alexandre Fleming, 49066 Angers CEDEX
>>
>> [image: Portable] +33 (0)6 28 03 81 32 [image: e-mail :]
>> blaurent at heurisis.eu <blaurent at heurisis.eu>
>> [image: tel :] +33 (0)9 54 30 41 14 [image: site :]
>>www.heurisis.eu<http://www.heurisis.eu/>
>>
>>
>> Visitez le site www.optiscolaire.fr
>>
>> [image: ?co :] Avant d?imprimer ce mail, pensez ? l?environnement
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL:
><http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130514/5ad6
>6f06/attachment.html>
>
>------------------------------
>
>_______________________________________________
>Qgis-developer mailing list
>Qgis-developer at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>End of Qgis-developer Digest, Vol 91, Issue 37
>**********************************************
More information about the Qgis-developer
mailing list