Quickbird


Tutorial – Retrieving and using imagery from Google Earth


This tutorial is a step-by-step instruction on how you can retrieve and use imagery from Google Earth. The procedure is done in four phases:

A. Capture image tiles from Google Earth B. Stitching image tiles C. Georeferencing and projecting the images D. Classifying the images

We have used this specifically to obtain data from some Quickbird (very high resolution) images on Google Earth.

The retrieved data has an advantage of being free of charge, however, some limitations apply in the spectral information

It is recommended that you read through the entire tutorial before starting capturing files.



    A) Obtaining imagery tiles from Google Earth

To perform this we have used Google Earth and Touratech QV. If you do not have these programs you can download them from: http://earth.google.com/download-earth.html (Free) http://www.ttqv.com/main.php?content=21&download=13 (25 day trial period)

Google Earth 1. Open Google Earth and go to your area of interest. 2. Set the elevation to show in meters (Tools/Options/3D View/Show Elevation) 3. Show elevation by clicking View/Status Bar 4. Unclick terrain in Side Bar/Layers 5. Zoom to an elevation where you can clearly see all the features you are interested in. Note elevation in meters 6. Zoom out so the screen covers your entire area of interest . 7. Reset to north and zero tilt if necessary (on the navigation bar) 8. Remove all excess information from the screen - side bar and tool bar (Tools/unclick side bar/tool bar) - compass, navigation, time, elevation (View/unclick compass, View/show navigation/never, View/show time/never, View/unclick Status bar) 9. Go to full screen (View/Full screen or F11)

Touratech QV 10. Open Touratech QV (Click Start Demo/OK) 11. Open Touratech QV X-plorer (Press F3) 12. Go to QV Data/New Database 13. Right-click Map table/Choose Import maps from Google Earth 14. Choose directory and filename 15. Click Multi JPG, automatic. Enter the zoom elevation where you could clearly see all features. 16. Click Unchanged on GE-Window size 17. Click OK 18. Touratech QV will now tell you how many rows and columns it will capture (Capture A). Click OK. The files are automatically assigned x-values that show their row-number and y-values that show their column-number, except for the top left tile. (Ex. A.jpg (=A_x00001_y00001), A_x00001_y00002.jpeg etc)

Re-run 19. In order to not lose data covered by the Google Earth TM stamp, Shift the Google Earth screen slightly downwards and re- run 13-18 (Capture B). Troubleshooting 1. Touratech does not capture images from your preferred elevation.

  - Make sure you have entered the elevation in meters.
  - If it still don’t work. Click on the GE window. Press r2r. Run 13-18

2. Touratech only captures one image.

  - Same as above

3. The compass/elevation shows on my tiles

   - You forgot to remove all information, see A8. The only additional information  
      that should show is the copyright-imprint from Google and possibly the image
      provider.

Tip If you have retrieved a Quickbird image, you can find out which date the image was captured by the Quickbird satellite by browsing the image library on www.digitalglobe.com


B) Stitching imagery tiles

We have used ArcMap to do this. Other software might have a similar process.

Setting up the files 1. Open ArcMap 2. Open New Empty Map 3. Click File/Save as and save your project under a suitable name 4. Click File/Add data 5. Browse to the folder where you saved your image files and open (all of) them. 6. Arcmap will ask you if you want to make pyramids. This is not necessary at this point. 7. Arcmap will inform you that the images have no georeference. They can therefore be drawn in ArcMap, but not projected. We will get to that later. 8. Make sure all files are visible (i.e. Do the files cover your entire area of interest, without any gaps or black squares?). If not, see troubleshooting below. 9. Each image will have a Google EarthTM imprint. This imprint will cause problem with your classification if it is not taken out. We take it out by alternately tiling the Capture A images with the Capture B images. Move the files where the filename contain “y00001” to the top of the display window by using drag and drop. (The display window is the one to the left). There should be as many files containing “y00001” as there are rows. 10. The first (topmost) file in the display window will overlay the second etc, so put the last file (highest X-number) from Capture B on top, followed by the last from Capture A etc ending with the first from Capture A. If you look (closely) at the first (leftmost) column you should not see any part of the Google EarthTM anywhere. If it still shows, see troubleshooting below. 11. Now that you made sure that all files are ok and you can tile them so the Google EarthTM does not show it is time to stitch them together in rows. You can either do this in the ArcToolbox or the Command Line window. Command Line is easier if you are doing several datasets, but both are described below. (The actual stitching is the same it’s, just two ways of doing it). If you choose Command Line go directly to number 17.

Stitching in ArcToolbox. 12. Click red toolbox icon or Window/ArcToolbox 13. Open Data Management Tools/Raster/MosaictonewRaster. A new window will open. 14. Choose your input rasters. To make rows, all the X-numbers should be the same. It does not matter if you go from highest to lowest or vice versa, just make sure you include all file with the same X-number (from one capture). When you are stitching rows together (or making columns) though, it is very important to start with the lowest number (northernmost row) in order to cover up the Google EarthTM in the tiling. 15. Enter as the following: Output location with extension - Example H:/Your Folder/Row_1A.tif Coordinate system – Skip Pixel type - 8_bit_unsigned (=default) Cellsize – Skip Number of bands – 3 (i.e. change the default 1) Mosaic Method – LAST (=default) Mosaic Colormap Mode – FIRST (=default) 16. Click OK

Stitching in Command Line window 17. Open Command Line Window (Either Command Line Icon or Window/Command Line) 18. In the command line you will enter the same procedure as you would have done in the ArcToolbox. The Command Line will help you by showing you what options you have and in which order they should be entered) Example: MosaicToNewRaster A.jpg; A_x00002_y00001.jpg; A_x00003_y00001.jpeg[…]; A_x00001_y00015.jpeg H:/Your folder/Row_1A.tif3 # 8_BIT_ UNSIGNED # 3 LAST FIRST (this is equivalent to [method] [input files] [output location with extension] [pixel type] [number of bands] [mosaic method] [mosaic colormap mode]) 19. Click Enter

In either Toolbox or Command Line 20. Re-do the procedure with the all the rows. (If you do it in the command line window you can copy the procedure to a word document and then use Edit/Find/Replace to change the filenames so you do not have to enter them more than once) 21. Re-do the procedure stitching all the rows together to a complete image

Troubleshooting: 1. The display window does not show - Click Window/Table of Contents 2. The Toolbox/Command Line Window does not show - Click Window ArcToolbox and/or Command Line. (Or View/Toolbars/Standard) 3. The image files do not cover my entire area of interest. - Something went wrong in capturing the files from Google Earth. Re-run A 13-18. DO NOT try to minimize the number of new files by zooming in to a smaller area. You will have trouble stitching later. Re-run the entire capture where the faulty files appear. Put the entire faulty capture in an “Old” folder – you might need them later still. 4. I have tiled the images alternately and the Google imprint still shows. - Sometimes the images are not equally sized, which means the Google Earth TM may show up anyway. If this happens, make another re-run (Capture C). 5. The MosaicToNewRaster fail to execute - Make sure all the files you are stitching are open (i.e. showing in the display window) - If you have used copy/paste, make sure all the filenames are entered correctly - If you have used copy/paste, try to entered MosaicToNewRaster manually (and remove the copied one). This has happened to me numerous times and I still don’t know why it works, but it does.



C) Projecting the files

You should now have /a/ complete image/s of your area of interest. These images are not projected though. After failing on the easiest path in ArcToolbox, we have tried two alternatives:

1. Use ArcMap/Arcinfo 2. Use GDAL A third alternative, to classify your unprojected images and then project the results, using GDAL or ArcInfo, should be possible, although we never did that.

Projecting in Arcmap/Arcinfo 1. Open Arcmap/Your image 2. Open Toolbox/Data Management Tools/Raster/Copy Raster 3. Choose Your Image as input and a short name as output without extension. Click OK. The image will now be saved as three GRIDs, one for each layer. 4. Open Arcinfo 5. Change the default workspace by entering w and the path to the folder where you saved your GRID-files. Example w H:/Your Folder/GRID 6. Create a projection file “utm.prj”, including: INPUT PROJECTION GEOGRAPHIC UNITS DD DATUM WGS84 PARAMETERS OUTPUT PROJECTION UTM 48 UNITS METERS END I have forgotten how you made the actual .prj file 7. List available grids by typing lg (or list grids). ArcInfo will show you a list of available GRIDs, there should be three files for each of your images (one for each layer) 8. Project the files separately by entering [Project] [grid] [your input file] [your output file] [your projection file] Example: Project grid a1c1 a1utm utm.prj 9. After all the grids are projected you stack them by entering [Make stack] [output file name] [list the files to be stacked] [input file name1] [input file name 2] [input file name 3] Example: Makestack Autm list A1utm A2utm A3utm 10. After the GRIDs are stacked you combine them back to one image by entering [gridimage] [input file name] [colormap] [output file name including extension][format] Example: Gridimage Autm none Autm.tif tiff

Projecting in GDAL

1. Ask Arnel


D) Classifying the images

We have used ENVI 4.2/4.3 to classify the images. Other software may have similar procedures and similar challenges. This section covers some basic steps but not a complete tutorial since it will differ depending on your classifying objectives.

The Quickbird images have the obvious advantage of having a very high resolution, but the spectral information (when retrieving it from Google Earth) is limited. Most importantly, if you are working with vegetation of any kind, there is no NIR or SWIR band, so you cannot do a false-color image. Furthermore, there are no thermal bands, so it will be more difficult to mask out the clouds. Bottom line: you have less spectral variation to work with and have to work around it to get good results. Different images also show variations between them or even within the same image, so finding a method that works on one image does not necessarily work on the next.

I use example name of files throughout to avoid confusion of which file to use. Feel free to choose your own file names.

Basic steps: 1. Cutting the fringes.

Your image will be tilted after you have projected it and it will also have a fringe of Landsat imagery from the Google Earth retrieval. We will take that out. 1. Open ENVI 4.2 2. Go to File/Open image and open your image file ex. Autm.tif. Click the “No Display” button at the bottom and change to “New Display”. 3. Click Load RBG. The Image will open in three windows. One large IMAGE-window that shows the picture in regular zoom, one SCROLL-window that shows the entire picture and one ZOOM-window that shows an excerpt of the image mark by a red square on the IMAGE-window. 4. Go to Basic Tools/Region of interest/Region of interest tool. 5. Change the ROI name from “Region#1” to ex. “Frame”. 6. Go to ROI_type. Click “Polygon” 7. Click “Scroll” on the window-row. 8. Choose black color by right-clicking the color of the region. 9. Maximize the SCROLL-window 10. Make a polygon that covers your entire area of interest (not the fringes). Right click to close the polygon. 11. Save the ROI ex. Frame.roi (Region of interest). 12. Go to Basic tools/Subset data via ROIs. 13. Select your image file (Autm.tif) as input file. Click OK 14. Select your newly saved ROI (Frame.roi) as input ROI. 15. Click the box “Mask pixels outside of ROI” so it says “YES” 16. Choose output name ex. Autm_frame. (It will then save the file to ENVI Standard) Click OK. This will give you an image where you only see your area of interest.

Masking Clouds (and, indeed, other stuff): A) Manually If there are few clouds in the picture, it is recommended to mask them manually. It will take a while, but the result will be much better (and failing to produce an acceptable result with another strategy will take even longer).

1. Go to Basic Tools/Region of interest/Region of interest tools 2. Rename a region “Clouds” and choose any color except white. (Tip: If you make a mistake with one polygon you cannot take it out, you have to scrap the entire region, which may consist of many polygons. To avoid that risk, you can click “New Region” and name it “Clouds2”, then “Clouds3” etc so if you have to scrap something, you don’t have to start all over again. If you need to merge them later, go to “options/merge regions”, but be sure to always save the original first). 3. Set the window row to “Image” 4. Maximize the IMAGE-window 5. Click in the SCROLL-window to move the image in the IMAGE-window. (if you have two monitors, put the scroll window on the other) 6. Make a polygon to cover the clouds. If you have to change your IMAGE-window position, first click “OFF” in the window row of the ROI-tool. (DO NOT click at anything in the IMAGE-window unless you are making a polygon. If you mistakenly start to make a polygon where you do not want one; go to the window row of the ROI-tool and click “OFF” before you close the polygon.) 7. When all the clouds are covered, save the ROI, ex Clouds.roi. 8. Go to Basic tools/Subset data via ROIs. 9. Choose to your original image ex. Autm as input file and your Cloud ROI as input ROI. (DO NOT click mask areas outside ROI). 10. Choose an output name ex. Autm _clouds. Click OK. 11. When the processing is finished, open the new band (Autm _clouds ) in a new display. It will be a black image with your ROI (subsetted areas) in color. 12. Go to Basic Tools/Masking/Build Mask. Choose display window that shows your subsetted image as input. 13. Go to options/import data range. Choose your subsetted image file (Autm_clouds) 14. Click min value 0 and max value 0. (This will inverse the picture, all non-mask areas will have the value 1 and the areas you will mask will have the value 0) 15. Choose output name ex. Autm_clouds_mask. Click OK. 16. Go to Basic Tools/Masking/Apply Mask 17. Choose your frame-subsetted file as input file (Autm_frame) and your mask band Autm_clouds_mask as mask band 18. Choose output name ex. Autm_frame_clouds. Click OK. This will give you an image with the frame and the clouds masked out.




Masking Clouds (and , indeed, other stuff) B) Via Maximum Likelihood Classification

If there are many/scattered clouds in the picture you might want to opt for an automatic classification. This will not be as accurate but probably faster.

1. Repeat step 1-7 above, but don’t bother to mask all the clouds. Just take a few samples. Basically, there more samples (training sites) you have, the better the classification will be, BUT: - if you have other areas in the picture that resembles clouds, e.g. towns, fields, water – having many training sites may increase the misclassification of those areas (i.e. the computer will think that the towns/fields/water are clouds too). In that case choose just a little training site that is representative of clouds. 2. Go to Classification/Supervised classification/Maximum Likelihood. 3. Choose your framed file (ex. Autm_frame.tif) as input file 4. Choose your cloud-ROI as input ROI. 5. If you have a small training set (e.g. ~500 points), choose a lower threshold (e.g. 0.7) to make so the classified areas will include more than your training sites. If you have many training sites (e.g. ~100 000 points or more) choose a higher threshold to avoid misclassification of other areas. 6. Choose an output name, ex. Autm_frame_cloud_maxlike_07 (if you have a threshold of 0.7). Click OK. 7. Compare the result by loading the output file to a new display, either by right-clicking the band/load band to new display or click “New Display” on the display button, then “Load band”. 8. Right click any of the pictures, choose geographic link. 9. Click On/On. Click OK 10. Compare the classification with the original file. THERE WILL BE ERRORS, BUT: - Are there obviously too many areas classified (as clouds)? – Do it again with a higher threshold - Are there obviously too few areas classified (as clouds)? – Do it again with a lower threshold - Are there obviously wrong areas classified (as clouds)? – Do it again with a new, smaller, ROI 11. Iterate this process until you are satisfied with the result. Remember – THERE WILL BE ERRORS, NO MATTER HOW WELL YOU DO IT. If you can’t get a good result, try to mask the clouds manually as described above. 12. When you are satisfied with the results, follow steps 12-18 above to mask out the clouds.

Do the same procedure with water, shadows, urban areas etc, that you would like to remove from the image before classifying.

Classification 1. Open your file where you have masked out all areas that might disturb the classification (ex. Autm_frame_clouds_water_shadow). 2. Go to Basic Tools/Region of interest/Region of interest tools 3. Do training sites of as many regions you are interested in. In this case, more training sites will mean better results, but due to the limited spectral information and variations within the picture (again) it is hard to predict where the misclassification will occur. Just do a few sites and then do a test run. 4. Go to Classification/Supervised classification/Maximum Likelihood 5. Choose your file 6. Choose all regions of interest – no threshold is necessary (they will “compete” against each other) 7. Check the result by loading the new file in a new window and link it to the original picture (right click/geographic link – on/on – ok) 8. Wherever you find (obvious) misclassifications, do new training sites (NOTE: There will always be speckles – go for the big stuff. 9. Re-iterate the procedure until you are happy with the result.

Post Classification 1. Your image will most probably be speckled. To remove (some) of the speckles go to Classification/Post Classification/Majority Analysis. 2. Choose your file 3. Choose kernel size, the higher the number, the bigger the smoothing of the speckles. I have used 5 or 7. If you go higher than that you might erase small important areas from your results.

Statistics 1. Go to Classification/Post classification/Generate Random Points 2. Choose the region of interest you wish to do statistics on 3. Choose “disproportionate” if you like to have the same number of points from each category. 4. Ask Alice what to do with them.

Last modified June 5, 2008 12:13 am