<html style="direction: ltr;">
<head>
<meta content="text/html; charset=windows-1255"
http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="preferred-charset"
bgcolor="#FFFFFF" text="#000000">
On 08/17/2012 09:25 PM, Pedro Camargo wrote:
<blockquote cite="mid:007701cd7ca5$be4d08a0$3ae719e0$@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1255">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:60755338;
mso-list-type:hybrid;
mso-list-template-ids:266656368 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif][if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoPlainText">Hi Micha,<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText"> Thanks for all the
help! <o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText" style="text-indent:.25in">I was finally
able to compute the statistics I needed. These were the steps
I followed:<o:p></o:p></p>
</div>
</blockquote>
<p><br>
</p>
<p>Good to hear of your success. Cc'ing back to the GRASS list so
others can follow.</p>
<p> </p>
<blockquote cite="mid:007701cd7ca5$be4d08a0$3ae719e0$@gmail.com"
type="cite">
<div class="WordSection1">
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">1.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Downloaded
the raster image from Cropspace (WGS84/Lag/long)<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">2.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Imported
the raster image into GRASS<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">3.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Imported
the area vector layer from a Shape file<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">4.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Added
centroids to the shape file (v.centroids)<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">5.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Converted
the vector layer into raster (v.to.rast using attr as values)<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1
lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">6.<span
style="font:7.0pt "Times New Roman""> </span></span><!--[endif]-->Computed
statistics for my raster layers using r.stats -c -a (gives me
a table with the sums of each combination of values in both
layers. Filtering this database for each value found in the
area layer, I have the statistics about the crop layer for
each one of my areas<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:.25in">It worked
beautifully, and the next step is to generate a batch/script
file to extend the analysis to the whole country and multiple
years (probably using Python, which I used before, or a DOS
batch).<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:.25in"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Thank you again,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"> Pedro<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">-----Original Message-----<br>
From: Micha Silver [<a class="moz-txt-link-freetext" href="mailto:micha@arava.co.il">mailto:micha@arava.co.il</a>] <br>
Sent: Wednesday, August 15, 2012 12:56 PM<br>
To: Pedro Camargo<br>
Subject: Re: [GRASS-user] Geotiff files</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Hi Pedro<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">On 08/15/2012 08:17 PM, Pedro Camargo
wrote:<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Hi Micha,<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Thanks for your
help. I was doing just like you <o:p></o:p></p>
<p class="MsoPlainText">> described in your instructions
(very precise, btw), but I keep finding <o:p></o:p></p>
<p class="MsoPlainText">> an error. Is it possible that I’m
working with a too big of a file?<o:p></o:p></p>
<p class="MsoPlainText">> It is the whole state of
California.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Yes that indeed could be the problem. To
get a better idea of what you're dealin with:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">After you have imported the raster into
GRASS, check what you get from g.region -p<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">( On the menu
"Settings->Region->Set Region" and check to print in the
Print tab). How many cells is the whole region?<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Next you can do r.univar -a
("Raster->Reports and Statistics->Univariate statistics"
and in the Print tab check for Area totals). This will tell
you how much total area for each category.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">> If I may also ask,
would it be easier just to compute <o:p></o:p></p>
<p class="MsoPlainText">> statistics (number of pixels of
each value/category) for each area I’m <o:p></o:p></p>
<p class="MsoPlainText">> interested in (Areas equivalent to
Counties in the whole Country)?<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Often the suggestion comes up to "think
raster". THis might be the case here. You could work the other
way, and covert the counties areas to a raster, then use it as
a "zone" parameter to the r.univar command. This will give the
univariate statistics for each category value in the counties
raster. There's a good example in the r.univar manual page: <o:p></o:p></p>
<p class="MsoPlainText"><a moz-do-not-send="true"
href="http://grass.osgeo.org/gdp/html_grass64/r.univar.html"><span
style="color:windowtext;text-decoration:none">http://grass.osgeo.org/gdp/html_grass64/r.univar.html</span></a><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Maybe that will help.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Cheers,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Micha<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">> Thanks for your help,<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Pedro<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> *From:*Micha Silver <a
moz-do-not-send="true"
href="mailto:[mailto:micha@arava.co.il]"><span
style="color:windowtext;text-decoration:none">[mailto:micha@arava.co.il]</span></a><o:p></o:p></p>
<p class="MsoPlainText">> *Sent:* Wednesday, August 15, 2012
2:47 AM<o:p></o:p></p>
<p class="MsoPlainText">> *To:* Pedro Camargo<o:p></o:p></p>
<p class="MsoPlainText">> *Cc:* <a moz-do-not-send="true"
href="mailto:grass-user@lists.osgeo.org"><span
style="color:windowtext;text-decoration:none">grass-user@lists.osgeo.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">> *Subject:* Re: [GRASS-user] Geotiff
files<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> On 08/14/2012 08:36 PM, Pedro
Camargo wrote:<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Hi,<o:p></o:p></p>
<p class="MsoPlainText">> I'm new to Grass and to
Raster files, and although I know some <o:p></o:p></p>
<p class="MsoPlainText">> concepts, I'm having trouble to
work with geotiff files. Basically, I <o:p></o:p></p>
<p class="MsoPlainText">> want to import tiff files
downloaded from <o:p></o:p></p>
<p class="MsoPlainText">> <a moz-do-not-send="true"
href="http://nassgeodata.gmu.edu/CropScape/"><span
style="color:windowtext;text-decoration:none">http://nassgeodata.gmu.edu/CropScape/</span></a>
into vector layers.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Any ideas on how can I do that?<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> I downloaded a small section of the
2011 landcover layer from the site <o:p></o:p></p>
<p class="MsoPlainText">> you linked to. In the download
options, I specified WGS84 Lat/Lon <o:p></o:p></p>
<p class="MsoPlainText">> coordinate system. (Otherwise is
was projected in an unknown, but <o:p></o:p></p>
<p class="MsoPlainText">> specified Albers Equal Area CRS).
Then I imported the raster into a <o:p></o:p></p>
<p class="MsoPlainText">> Lat/Lon WGS84 LOCATION in GRASS
using: r.in.gdal. No problem here:<o:p></o:p></p>
<p class="MsoPlainText">> r.in.gdal in=NASS....tif out=nass<o:p></o:p></p>
<p class="MsoPlainText">> # Or in the GUI, File->Import
raster->Common import formats g.region <o:p></o:p></p>
<p class="MsoPlainText">> -p rast=nass #
Settings->Region->Set Region->Set to raster<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Next I did r.to.vect with the
parameter "feature=area". This indeed <o:p></o:p></p>
<p class="MsoPlainText">> created a polygon vector map:<o:p></o:p></p>
<p class="MsoPlainText">> r.to.vect in=nass out=nass
feature=area # In the GUI, File->Map type <o:p></o:p></p>
<p class="MsoPlainText">> conversions->Raster to vector<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> However you need to be aware that
the raster will be come many tens of <o:p></o:p></p>
<p class="MsoPlainText">> thousands of small polygons. I
downloaded a small section of MA and it <o:p></o:p></p>
<p class="MsoPlainText">> was about 1000 columns X 500 rows.
A 500,000 cell raster is not large.<o:p></o:p></p>
<p class="MsoPlainText">> But, converted to a vector this
became 77,000 little polygons.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> So the procedure works. The
question is: Is that what you want? What's <o:p></o:p></p>
<p class="MsoPlainText">> your next step?<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Thanks,<o:p></o:p></p>
<p class="MsoPlainText">> Pedro<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> PS - I'm using the GUI<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> This mail was received via
Mail-SeCure System.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">>
_______________________________________________<o:p></o:p></p>
<p class="MsoPlainText">> grass-user mailing list<o:p></o:p></p>
<p class="MsoPlainText">> <a moz-do-not-send="true"
href="mailto:grass-user@lists.osgeo.org"><span
style="color:windowtext;text-decoration:none">grass-user@lists.osgeo.org</span></a>
<<a moz-do-not-send="true"
href="mailto:grass-user@lists.osgeo.org"><span
style="color:windowtext;text-decoration:none">mailto:grass-user@lists.osgeo.org</span></a>><o:p></o:p></p>
<p class="MsoPlainText">> <a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/grass-user"><span
style="color:windowtext;text-decoration:none">http://lists.osgeo.org/mailman/listinfo/grass-user</span></a><o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> This mail was received via
Mail-SeCure System.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> This mail was received via
Mail-SeCure System.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">--<o:p></o:p></p>
<p class="MsoPlainText">Micha Silver<o:p></o:p></p>
<p class="MsoPlainText">GIS Consultant, Arava Development Co.<o:p></o:p></p>
<p class="MsoPlainText"><a moz-do-not-send="true"
href="http://www.surfaces.co.il"><span
style="color:windowtext;text-decoration:none">http://www.surfaces.co.il</span></a><o:p></o:p></p>
</div>
<br>
<br>
This mail was received via Mail-SeCure System.<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
GIS Consultant, Arava Development Co.
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
</body>
</html>