[GRASS-dev] Programmatically obtain GRASS colour ramps in Python

Vaclav Petras wenzeslaus at gmail.com
Mon Sep 17 18:03:06 PDT 2018


Hi Pierre,

If you would turn this into a add-on module it could eventually became the
portable way to do that... Having this functionality makes sense.

Vaclav

On Mon, Sep 17, 2018 at 3:28 PM Stefan Blumentrath <
Stefan.Blumentrath at nina.no> wrote:

> r.colors manual says color ramps are saved in:
> $GISBASE/etc/colors/<name>, so values could be read from there, I guess.
>
> And the parser can give you GUI access to the rules names with the
> G_OPT_M_COLR option:
> https://grass.osgeo.org/grass77/manuals/parser_standard_options.html
>
> Cheers
> Stefan
>
>
> -----Original Message-----
> From: grass-dev <grass-dev-bounces at lists.osgeo.org> On Behalf Of Markus
> Neteler
> Sent: mandag 17. september 2018 20:15
> To: Pierre Roudier <pierre.roudier at gmail.com>
> Cc: GRASS developers list <grass-dev at lists.osgeo.org>
> Subject: Re: [GRASS-dev] Programmatically obtain GRASS colour ramps in
> Python
>
> On Mon, Sep 17, 2018 at 4:17 AM Pierre Roudier <pierre.roudier at gmail.com>
> wrote:
> >
> > Hi all,
> >
> > I am trying to write a little Python extension wrapping r.color to use
> > different kind of strecthes,
> >
> > It should be pretty simple, basically just builkding rules on-the-fly
> > and pass them to r.color. But I can't quite seem how to retrieve the
> > GRASS color ramps details to create my ruleset.
> >
> > Is there any portable way to actually to actually passthe name of a
> > GRASS color ramp, and get the details (colours) of that colour ramp?
>
> Maybe you can find some code here:
>
> gui/wxpython/modules/colorrules.py
>
> best
> Markus
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180917/07d147d9/attachment.html>


More information about the grass-dev mailing list