Re: [GRASS-user] Geotiff files
Will do!!! On Fri, Aug 17, 2012 at 11:33 AM, Micha Silver wrote: > On 08/17/2012 09:25 PM, Pedro Camargo wrote: > > Hi Micha, > > > > Thanks for all the help! > > ** ** > > I was finally able to compute the statistics I needed. These were the > steps I followed: > > > Good to hear of your success. Cc'ing back to the GRASS list so others > can follow. > > > > ** ** > > 1. Downloaded the raster image from Cropspace (WGS84/Lag/long) > > 2. Imported the raster image into GRASS > > 3. Imported the area vector layer from a Shape file > > 4. Added centroids to the shape file (v.centroids) > > 5. Converted the vector layer into raster (v.to.rast using attr as > values) > > 6. 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 > > ** ** > > ** ** > > 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). > > ** ** > > ** ** > > Thank you again, > > ** ** > > Pedro**** > > ** ** > > -----Original Message- > From: Micha Silver [mailto:mi...@arava.co.il ] > Sent: Wednesday, August 15, 2012 12:56 PM > To: Pedro Camargo > Subject: Re: [GRASS-user] Geotiff files > > ** ** > > Hi Pedro > > ** ** > > On 08/15/2012 08:17 PM, Pedro Camargo wrote: > > >** ** > > > Hi Micha, > > >** ** > > > Thanks for your help. I was doing just like you > > > described in your instructions (very precise, btw), but I keep finding * > *** > > > an error. Is it possible that I’m working with a too big of a file? > > > It is the whole state of California. > > >** ** > > ** ** > > Yes that indeed could be the problem. To get a better idea of what you're > dealin with: > > ** ** > > After you have imported the raster into GRASS, check what you get from > g.region -p > > ** ** > > ( On the menu "Settings->Region->Set Region" and check to print in the > Print tab). How many cells is the whole region? > > ** ** > > 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. > > ** ** > > ** ** > > > If I may also ask, would it be easier just to compute ** > ** > > > statistics (number of pixels of each value/category) for each area I’m * > *** > > > interested in (Areas equivalent to Counties in the whole Country)? > > >** ** > > ** ** > > 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: > > http://grass.osgeo.org/gdp/html_grass64/r.univar.html > > ** ** > > Maybe that will help. > > ** ** > > Cheers, > > ** ** > > Micha > > ** ** > > > Thanks for your help, > > >** ** > > > Pedro > > >** ** > > > *From:*Micha Silver [mailto:mi...@arava.co.il] > > > *Sent:* Wednesday, August 15, 2012 2:47 AM > > > *To:* Pedro Camargo > > > *Cc:* grass-user@lists.osgeo.org > > > *Subject:* Re: [GRASS-user] Geotiff files > > >** ** > > > On 08/14/2012 08:36 PM, Pedro Camargo wrote: > > >** ** > > > Hi, > > > I'm new to Grass and to Raster files, and although I know some *** > * > > > concepts, I'm having trouble to work with geotiff files. Basically, I ** > ** > > > want to import tiff files downloaded from > > > http://nassgeodata.gmu.edu/CropScape/ into vector layers. > > >** ** > > > Any ideas on how can I do that? > > >** ** > > >** ** > > > I downloaded a small section of the 2011 landcover layer from the site * >
Re: [GRASS-user] Geotiff files
On 08/17/2012 09:25 PM, Pedro Camargo wrote: Hi Micha, Thanks for all the help! I was finally able to compute the statistics I needed. These were the steps I followed: Good to hear of your success. Cc'ing back to the GRASS list so others can follow. 1. Downloaded the raster image from Cropspace (WGS84/Lag/long) 2. Imported the raster image into GRASS 3. Imported the area vector layer from a Shape file 4. Added centroids to the shape file (v.centroids) 5. Converted the vector layer into raster (v.to.rast using attr as values) 6. 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 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). Thank you again, Pedro -Original Message- From: Micha Silver [mailto:mi...@arava.co.il] Sent: Wednesday, August 15, 2012 12:56 PM To: Pedro Camargo Subject: Re: [GRASS-user] Geotiff files Hi Pedro On 08/15/2012 08:17 PM, Pedro Camargo wrote: > > Hi Micha, > > Thanks for your help. I was doing just like you > described in your instructions (very precise, btw), but I keep finding > an error. Is it possible that I’m working with a too big of a file? > It is the whole state of California. > Yes that indeed could be the problem. To get a better idea of what you're dealin with: After you have imported the raster into GRASS, check what you get from g.region -p ( On the menu "Settings->Region->Set Region" and check to print in the Print tab). How many cells is the whole region? 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. > If I may also ask, would it be easier just to compute > statistics (number of pixels of each value/category) for each area I’m > interested in (Areas equivalent to Counties in the whole Country)? > 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: http://grass.osgeo.org/gdp/html_grass64/r.univar.html Maybe that will help. Cheers, Micha > Thanks for your help, > > Pedro > > *From:*Micha Silver [mailto:mi...@arava.co.il] > *Sent:* Wednesday, August 15, 2012 2:47 AM > *To:* Pedro Camargo > *Cc:* grass-user@lists.osgeo.org > *Subject:* Re: [GRASS-user] Geotiff files > > On 08/14/2012 08:36 PM, Pedro Camargo wrote: > > Hi, > I'm new to Grass and to Raster files, and although I know some > concepts, I'm having trouble to work with geotiff files. Basically, I > want to import tiff files downloaded from > http://nassgeodata.gmu.edu/CropScape/ into vector layers. > > Any ideas on how can I do that? > > > I downloaded a small section of the 2011 landcover layer from the site > you linked to. In the download options, I specified WGS84 Lat/Lon > coordinate system. (Ot
Re: [GRASS-user] Geotiff files
On 08/14/2012 08:36 PM, Pedro Camargo wrote: Hi, I'm new to Grass and to Raster files, and although I know some concepts, I'm having trouble to work with geotiff files. Basically, I want to import tiff files downloaded from http://nassgeodata.gmu.edu/CropScape/ into vector layers. Any ideas on how can I do that? I downloaded a small section of the 2011 landcover layer from the site you linked to. In the download options, I specified WGS84 Lat/Lon coordinate system. (Otherwise is was projected in an unknown, but specified Albers Equal Area CRS). Then I imported the raster into a Lat/Lon WGS84 LOCATION in GRASS using: r.in.gdal. No problem here: r.in.gdal in=NASStif out=nass # Or in the GUI, File->Import raster->Common import formats g.region -p rast=nass # Settings->Region->Set Region->Set to raster Next I did r.to.vect with the parameter "feature=area". This indeed created a polygon vector map: r.to.vect in=nass out=nass feature=area # In the GUI, File->Map type conversions->Raster to vector However you need to be aware that the raster will be come many tens of thousands of small polygons. I downloaded a small section of MA and it was about 1000 columns X 500 rows. A 500,000 cell raster is not large. But, converted to a vector this became 77,000 little polygons. So the procedure works. The question is: Is that what you want? What's your next step? Thanks, Pedro PS - I'm using the GUI This mail was received via Mail-SeCure System. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user