[GRASS-user] generate thematic map from a raster

Markus Neteler neteler at osgeo.org
Sun Jan 1 14:57:47 EST 2012


On Sat, Dec 31, 2011 at 12:13 AM, Salvatore Mellino
<salvatore.mellino at gmail.com> wrote:
> Hi,
>
> I want to generate a thematic map from a raster. I want to classify values with
> natural breaks method and I want to generate 5 classes and at the end I
> want color them. How can I do?

Do you refer to
http://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization
?

To my knowledge it is not yet implemented in GRASS.

Markus

PS: I found this earlier post in this mailing list archive, perhaps interesting:

On Sat, Nov 1, 2008 at 1:47 AM, Edward Tomlinson <e.j.tommo at gmail.com> wrote:
> Hi all,
>
> I am not sure as to which list this best fits (Grass or R-sig-geo).
>
> I am trying to reclass a raster map (ndvi) into 5 different zones using the
> fisher method, ultimatley i am trying to reclass as natural breaks.
>
> The point of this exercise is for precision agriculture. I want to determine
> management zones according to the current crop, so i can use this
> information for inputs for next years crop. Therefore i have no use for a
> range of ndvi values -1 thru 1. I need to split this into a number of zones
> (5 or 7 is good number, unless i can get an algorithm to determine the exact
> number of groups it needs). Each zone then in turn needs to be ground
> truthed (hence need for classifying into 5 or 7 zones).
>
> My problem at the moment is that the way i am doing it takes a while... I
> would sure love it if anyone has any suggestions to speed up the process...
> Is it possible to do the reclass bit in R and export the raster
> (SpatialDataFrame) back into grass? I have read a post from Roger Bivand on
> how to do the whole classinterval thing (thank you Roger) however i am
> unsure of how then to create a new image from those values. I have looked
> through the sp package breifly but I dont very well understand the R system.
>
>
> Current method (this has to be done for each paddock, or paddocks can be
> grouped if they have similar management history).
>
> create ndvi
> r.mapcalc 'ndvi=1.0*(nir-red)/(nir+red)'
> move ndvi raster to R
> -R-R-R-----------------
> library(spgrass6)
> G <- gmeta6()
> ndvi <- readRAST6(ndvi at mapset)
> library(classInt)
> t1 <- classIntervals(ndvi$ndvi.mapset, n=5, style="fisher")
> print(t1)
> --------------------------------
> create text document for reclass rules, multiply everything by 10,000,000
> (as reclass will round my numbers)
> -----------------------------
> back in grass
> r.mapcalc ndvi_10M = ndvi * 10000000
> r.reclass input=ndvi_10M output=ndvi.reclass rules="rules created in text
> doc" title="title"
>
>
> I hope this all makes sense. Thank you for your time and reading through my
> problem. If you have any suggestions i sure would be greatful.
>
> Kind regards,
> Ed
>


More information about the grass-user mailing list