Here it goes... :
It's my first attempt to write a functional script
(attached below), so please, if you have the time, correct
my mistakes.
So far:
1. I managed to grab pixel values from rasters covered by
vector areas and export them in .txt (or .csv) file(s).
2. If I get the upload to
About point 4), you can do it simply adding (v.db.addcol) at the
beginning of your job, then insert something like this into the loop:
echo UPDATE (your_table) SET pixval=(what_you_want_to_upload) WHERE
FID=$i | db.execute
Inside what_you_want_to_upload you can grab what you want from the
I tried to make it clear in the title... but I am not sure
that it's easy to understand.
Using v.rast.stats I get uni-variate statistics from a
raster (in my case a MODIS image with 250m pixel size)
based on polygons I digitised manually (areas).
How can I get listed all unique pixel values
Just a rapid idea.
You could make just one rasterized map of your polygons and then
insert in a loop this, giving each pixel a unique category value:
r.mapcalc MASK = if(raster=$i,1,null())
with $1 the cat value (deriving from you original polygon)
and then run r.stats, which will work only for
Salut Jose!
This is what I am doing... and I only have 7 polygons - so
it is ok.
But if I have 50 polygons... I am not so sure how to script
it to get (finally) a table with all pixels for each unique
polygon for 2 different images of the same location (for
raster MODIS year 2006 and then
Giovanni,
thank you for your proposal.
The link to the FAQ (the one that Jose provided) looks like a solution.
But your idea is clever as well and I had a similar way in my mind.
If I got it correct you suggest:
1. VectorTargetAreas ~~~v.to.rast (based on unique attribute like cat
or FID~~~