Will do!!!<br><br><div class="gmail_quote">On Fri, Aug 17, 2012 at 11:33 AM, Micha Silver <span dir="ltr"><<a href="mailto:micha@arava.co.il" target="_blank">micha@arava.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
    
  
  <div style="direction:ltr" bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 08/17/2012 09:25 PM, Pedro Camargo wrote:
    </div><blockquote type="cite">
      
      
      
      <div>
        <p>Hi Micha,<u></u><u></u></p>
        <p>                <u></u><u></u></p>
        <p>                Thanks for all the
          help!  <u></u><u></u></p><div class="im">
        <p><u></u> <u></u></p>
        <p style="text-indent:.25in">I was finally
          able to compute the statistics I needed. These were the steps
          I followed:<u></u><u></u></p>
      </div></div>
    </blockquote>
    <p><br>
    </p>
    <p>Good to hear of your success. Cc'ing back to the GRASS list so
      others can follow.</p><div><div class="h5">
    <p> </p>
    <blockquote type="cite">
      <div>
        <p><u></u> <u></u></p>
        <p style="margin-left:.5in"><span>1.<span style="font:7.0pt "Times New Roman"">       </span></span>Downloaded
          the raster image from Cropspace (WGS84/Lag/long)<u></u><u></u></p>
        <p style="margin-left:.5in"><span>2.<span style="font:7.0pt "Times New Roman"">       </span></span>Imported
           the raster image into GRASS<u></u><u></u></p>
        <p style="margin-left:.5in"><span>3.<span style="font:7.0pt "Times New Roman"">       </span></span>Imported
          the area vector layer from a Shape file<u></u><u></u></p>
        <p style="margin-left:.5in"><span>4.<span style="font:7.0pt "Times New Roman"">       </span></span>Added
          centroids to the shape file (v.centroids)<u></u><u></u></p>
        <p style="margin-left:.5in"><span>5.<span style="font:7.0pt "Times New Roman"">       </span></span>Converted
          the vector layer into raster (v.to.rast using attr as values)<u></u><u></u></p>
        <p style="margin-left:.5in"><span>6.<span style="font:7.0pt "Times New Roman"">       </span></span>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<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p 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).<u></u><u></u></p>
        <p style="margin-left:.25in"><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p>Thank you again,<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>                Pedro<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>-----Original Message-----<br>
          From: Micha Silver [<a href="mailto:micha@arava.co.il" target="_blank">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><u></u> <u></u></p>
        <p>Hi Pedro<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>On 08/15/2012 08:17 PM, Pedro Camargo
          wrote:<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Hi Micha,<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>>                   Thanks for your
          help. I was doing just like you <u></u><u></u></p>
        <p>> described in your instructions
          (very precise, btw), but I keep finding <u></u><u></u></p>
        <p>> an error.  Is it possible that I’m
          working with a too big of a file?<u></u><u></u></p>
        <p>> It is the whole state of
          California.<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p>Yes that indeed could be the problem. To
          get a better idea of what you're dealin with:<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>After you have imported the raster into
          GRASS, check what you get from g.region -p<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>( On the menu
          "Settings->Region->Set Region" and check to print in the
          Print tab). How many cells is the whole region?<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>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.<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p>>                 If I may also ask,
          would it be easier just to compute <u></u><u></u></p>
        <p>> statistics (number of pixels of
          each value/category) for each area I’m <u></u><u></u></p>
        <p>> interested in (Areas equivalent to
          Counties in the whole Country)?<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p>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:  <u></u><u></u></p>
        <p><a href="http://grass.osgeo.org/gdp/html_grass64/r.univar.html" target="_blank"><span style="color:windowtext;text-decoration:none">http://grass.osgeo.org/gdp/html_grass64/r.univar.html</span></a><u></u><u></u></p>


        <p><u></u> <u></u></p>
        <p>Maybe that will help.<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>Cheers,<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>Micha<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p>> Thanks for your help,<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Pedro<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> *From:*Micha Silver <a href="mailto:[mailto:micha@arava.co.il]" target="_blank"><span style="color:windowtext;text-decoration:none">[mailto:micha@arava.co.il]</span></a><u></u><u></u></p>
        <p>> *Sent:* Wednesday, August 15, 2012
          2:47 AM<u></u><u></u></p>
        <p>> *To:* Pedro Camargo<u></u><u></u></p>
        <p>> *Cc:* <a href="mailto:grass-user@lists.osgeo.org" target="_blank"><span style="color:windowtext;text-decoration:none">grass-user@lists.osgeo.org</span></a><u></u><u></u></p>
        <p>> *Subject:* Re: [GRASS-user] Geotiff
          files<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> On 08/14/2012 08:36 PM, Pedro
          Camargo wrote:<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Hi,<u></u><u></u></p>
        <p>>       I'm new to Grass and to
          Raster files, and although I know some <u></u><u></u></p>
        <p>> concepts, I'm having trouble to
          work with geotiff files. Basically, I <u></u><u></u></p>
        <p>> want to import tiff files
          downloaded from <u></u><u></u></p>
        <p>> <a href="http://nassgeodata.gmu.edu/CropScape/" target="_blank"><span style="color:windowtext;text-decoration:none">http://nassgeodata.gmu.edu/CropScape/</span></a>
          into vector layers.<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Any ideas on how can I do that?<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>> I downloaded a small section of the
          2011 landcover layer from the site <u></u><u></u></p>
        <p>> you linked to. In the download
          options, I specified WGS84 Lat/Lon <u></u><u></u></p>
        <p>> coordinate system. (Otherwise is
          was projected in an unknown, but <u></u><u></u></p>
        <p>> specified Albers Equal Area CRS).
          Then I imported the raster into a <u></u><u></u></p>
        <p>> Lat/Lon WGS84 LOCATION in GRASS
          using: r.in.gdal. No problem here:<u></u><u></u></p>
        <p>> r.in.gdal in=NASS....tif out=nass<u></u><u></u></p>
        <p>> # Or in the GUI, File->Import
          raster->Common import formats g.region <u></u><u></u></p>
        <p>> -p rast=nass #
          Settings->Region->Set Region->Set to raster<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Next I did r.to.vect with the
          parameter "feature=area". This indeed <u></u><u></u></p>
        <p>> created a polygon vector map:<u></u><u></u></p>
        <p>> r.to.vect in=nass out=nass
          feature=area # In the GUI, File->Map type <u></u><u></u></p>
        <p>> conversions->Raster to vector<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> However you need to be aware that
          the raster will be come many tens of <u></u><u></u></p>
        <p>> thousands of small polygons. I
          downloaded a small section of MA and it <u></u><u></u></p>
        <p>> was about 1000 columns X 500 rows.
          A 500,000 cell raster is not large.<u></u><u></u></p>
        <p>> But, converted to a vector this
          became 77,000 little polygons.<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>> So the procedure works. The
          question is: Is that what you want? What's <u></u><u></u></p>
        <p>> your next step?<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>> Thanks,<u></u><u></u></p>
        <p>>                  Pedro<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>> PS - I'm using the GUI<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>> This mail was received via
          Mail-SeCure System.<u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>>
          _______________________________________________<u></u><u></u></p>
        <p>> grass-user mailing list<u></u><u></u></p>
        <p>> <a href="mailto:grass-user@lists.osgeo.org" target="_blank"><span style="color:windowtext;text-decoration:none">grass-user@lists.osgeo.org</span></a> 
          <<a href="mailto:grass-user@lists.osgeo.org" target="_blank"><span style="color:windowtext;text-decoration:none">mailto:grass-user@lists.osgeo.org</span></a>><u></u><u></u></p>
        <p>> <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank"><span style="color:windowtext;text-decoration:none">http://lists.osgeo.org/mailman/listinfo/grass-user</span></a><u></u><u></u></p>


        <p>>   <u></u><u></u></p>
        <p>> This mail was received via
          Mail-SeCure System.<u></u><u></u></p>
        <p>>   <u></u><u></u></p>
        <p>>   <u></u><u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>><u></u> <u></u></p>
        <p>> This mail was received via
          Mail-SeCure System.<u></u><u></u></p>
        <p><u></u> <u></u></p>
        <p><u></u> <u></u></p>
        <p>--<u></u><u></u></p>
        <p>Micha Silver<u></u><u></u></p>
        <p>GIS Consultant, Arava Development Co.<u></u><u></u></p>
        <p><a href="http://www.surfaces.co.il" target="_blank"><span style="color:windowtext;text-decoration:none">http://www.surfaces.co.il</span></a><u></u><u></u></p>
      </div>
      <br>
      <br>
      This mail was received via Mail-SeCure System.<br>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
Micha Silver
GIS Consultant, Arava Development Co.
<a href="http://www.surfaces.co.il" target="_blank">http://www.surfaces.co.il</a></pre>
  </div></div></div>

</blockquote></div><br>