Re: Extract values from an AOI
By Donn Rodekohr in ERDAS Software Forum
Zhuoting,
.sta files go all the way back to ERDAS 7.5 days! Either your age is showing (like mine) or we are talking of a different kind of .sta.
In Image info, when you compute the stats using an AOI the statistics are reported directly to the screen and stored in the image statistics. When you are looking at the raster attributes you are looking the values from within the AOI.
There are numerous ways to extract the values within an AOI. The most direct manor is to use SUBSET specifying the AOI as the constrainer. The output file will contain only the values within the AOI so if you compute stats with a skip factor of 1,1 you will have stats for every pixel value within the AOI. Also, within Image info you can click on the Pixel tag and examine each pixel data value. Depending upon the file dimensions, you can select all rows and columns and then copy the values and paste them into a spreadsheet.
If you want all of the pixel values in one file, use Tools -- Pixel to ASCII and create a .asc file. You can open this file with Excel (for example) by specifying a Space delimiter. Now you can do whatever summary stats you care to generate.
Hope this help.s
----------------------------------
You were sent this email because you opted to receive email notifications when someone responded to this thread.
To unsubscribe:
By Zhuoting in ERDAS Software Forum
Donn,
Thanks very much for your reply and it's very helpful. I think the problem is that my AOI and the raster layers do not overlay even though they are in the same projection (Lat/Lon, WGS84). I still don't know why. I think I probably will try this in other softwares.
thanks,
Zhuoting
By Donn Rodekohr in ERDAS Software Forum
Zhuoting,
If the AOI and the raster layer do not overlay then it is impossible extract values from the image using that AOI. That AOI will ALWAYS report no values.
It is not a software problem, it is an AOI problem. How was the AOI created?
By Zhuoting in ERDAS Software Forum
The AOI is a country boundary that I downloaded (shp file), and then I converted to an AOI. I actually tried to do this in ENVI:
I input the raster in ENVI and the header is missing, and I need the "map coordinates of the tie point" but I cannot find it in ERDAS image info. So I exported the raster from ERDAS as a geotiff file, and opened it in ENVI to get the "map coordinates of the tie point". It showed that the coordinates are "-179.95N, 89.95E" which are definitely not right! So I changed it to "-179.95E, 89.95N" and it seemed to overlay OK (not perfect) with the shape file, and I could go ahead extracting values in ENVI. My concern is if this is the right way to find the "map coordinates of the tie point"?
I hope I explained this clear, and I'll very appreciate your help. Thanks!
Zhuoting
By Donn Rodekohr in ERDAS Software Forum
I guess I'm still a bit confused about 2 things.
First, the term "map coordinates of the tie point" is unknown to me. Something that is unique to ENVI I would presume. One could assume that this is either the upper left or lower left corner of the image depending upon where ENVI starts counting. ERDAS refers to the upper left corner as the image origin and computes pixel locations from that point. The lat/long coordinates you listed do not make sense, agreed. However, if ENVI stripped the header from the imagery (which is embedded in the .img file) then all bets are off since any georeferencing material has been discarded upon import.
-- What was the original format of the raster file? If it was .img or .tif or GeoTiff, there is no need to pass it through ENVI before Imagine can read it.
Secondly, your statement that "I downloaded (shp file), and then I converted to an AOI. I actually tried to do this in ENVI" confuses me more. Did you use ENVI to create the AOI? If so, I would have very low expectations that it would work as an AOI in Imagine. Another item is that sometimes boundary files are polyline or line files, not polygons. If I was going to use a boundary shapefile as an AOI this is what I would do:
1. Open the .shp in an Imagine viewer with nothing else in the viewer. If the boundary displays as a cyan colored polygon, then go to step 3. If it shows up as a black line on a white screen, go to Step 2.
2. Start up ArcMap. Add the .shp file to the viewing screen. Click Toolbox -- Data management Tools -- Features -- Feature to Polygon. Convert the line to a polygon and display it to be sure it defines all the areas in a polygon. Sometimes boundaries don't close. Note the name of this new boundary file and use it from now on.
3. In the Imagine viewer, read the newly created boundary polygon file from step 2 if necessary. Click the i button to get polygon info. Make sure that it is fully georeferenced with Projection, Datum, and Spheroid values reported. I have downloaded too many boundary files that are throwbacks to ArcView 3.x days that have only coordinates and no projection information. If these data are unprojected, use the Edit function on the polygon info table to fill in the correct projection information for the shapefile.
4. Clear the viewer. Re-read the .shp file to make sure that it has full projection information. It will show on the lower status panel on the bottom of the viewer when you move the mouse across the viewer.
5. Create another viewer, read the imagery that you want to extract. Click the Image Info button and check the georeferencing information about the imagery. Make sure that it is fully georeferenced with Projection, Datum, and Spheroid values reported AND that it agrees completely with the georeferencing information for the polygon shapefile. If there is any discrepancy between the two, REPROJECT either the raster or the vector to match.
6. Assuming that the georeferencing matches, in the viewer with the .shp file displayed, select the country polygon you want to convert to an AOI. It should turn yellow. Click AOI -- Convert selection to AOI. There should be a dashed line duplicating the boundary of the shapefile.
7. In the shapefile viewer, click File -- Save AOI layer as... and save the AOI to a file name.
8. In the raster viewer, File open AOI and select the AOI file you just saved. It should overlay precisely as the georeferencing allows.
Now you can use this AOI for any area of interest computation with an imagery that has the same georeferencing.
By Zhuoting in ERDAS Software Forum
Hi Donn,
Thanks so much for your reply and detailed explanation.
The upper left corner is also my first thought of the "tie point", but I used the coordinates (-180E, 90N), and it's not the correct one.
The procedures you listed above are exactly how I created the AOI, and it's in exactly the same projection, datum, and spheroid values (Geographic, Lat/Lon, WGS84) with the raster layer (.ers, ER mapper format). However, the AOI does not overlay with the raster! I don't know why and I think I did everything I can, and I probably will go back to ENVI to figure out the tie point, and go from there.
Thanks very much!
Zhuoting