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@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