Re: [Qgis-developer] Is it possible to write classification scripts for the graduated renderer in Python?

2014-11-04 Thread Anita Graser
On Nov 4, 2014 10:11 AM, "Martin Dobias"  wrote:
>
> Hi Anita
>
> On Fri, Oct 31, 2014 at 12:46 AM, Anita Graser  wrote:
> > Hi,
> >
> > Is it possible to write classification scripts for the graduated
renderer in
> > Python?
>
> Depends what you mean. If you mean to add another method like Equal
> Interval / Quantiles / Natural Breaks - then you would need to write
> them in C++ and add them to the core library (this is not extensible).

Thanks for the clarification Martin. I was hoping this would be extensible
using Python.

> But of course you can come up with your own classification algorithm
> and create the graduated renderer easily in a Python script:
>
> ranges=[QgsRendererRangeV2(1,100,
> QgsSymbolV2.defaultSymbol(QGis.Point), "1 - 100")]
> r=QgsGraduatedSymbolRendererV2("cat", ranges)
> iface.activeLayer().setRendererV2(r)

I'll probably give this approach a try then.

Best wishes and thanks
Anita
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Is it possible to write classification scripts for the graduated renderer in Python?

2014-11-04 Thread Martin Dobias
Hi Anita

On Fri, Oct 31, 2014 at 12:46 AM, Anita Graser  wrote:
> Hi,
>
> Is it possible to write classification scripts for the graduated renderer in
> Python?

Depends what you mean. If you mean to add another method like Equal
Interval / Quantiles / Natural Breaks - then you would need to write
them in C++ and add them to the core library (this is not extensible).

But of course you can come up with your own classification algorithm
and create the graduated renderer easily in a Python script:

ranges=[QgsRendererRangeV2(1,100,
QgsSymbolV2.defaultSymbol(QGis.Point), "1 - 100")]
r=QgsGraduatedSymbolRendererV2("cat", ranges)
iface.activeLayer().setRendererV2(r)


Cheers
Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Is it possible to write classification scripts for the graduated renderer in Python?

2014-10-30 Thread Anita Graser

Hi,

Is it possible to write classification scripts for the graduated renderer  
in Python?
I recently had a talk with someone who would like to have an equal area  
classification and might be willing to add it but I'm not sure if it's  
possible using Python or if he would have to use C++.


Thanks and best wishes,
Anita


--
anitagraser.com
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer