[Qgis-developer] Adding labels

Benoît Laurent blaurent at heurisis.eu
Tue May 14 08:30:59 PDT 2013


Many thanks Larry !

I eventually installed the weekly build. I used the test script you 
mentionned and it works great ! I had struggled for two days.

Thank you again.

Benoît
> Hi Benoît ,
>
> On Tue, May 14, 2013 at 3:18 AM, Benoît Laurent <blaurent at heurisis.eu 
> <mailto: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_qgspallabeling.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
>>     <mailto:Qgis-developer at lists.osgeo.org>
>>     http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>     -- 
>     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
>     <tel:%2B33%20%280%299%2054%2030%2041%2014> 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
>
>
>
>     _______________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto: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/d2bae828/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/d2bae828/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/d2bae828/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/d2bae828/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/d2bae828/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/d2bae828/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/d2bae828/attachment-0009.gif>


More information about the Qgis-developer mailing list