└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Creating your first satellite image 2 | 3 | In this hands-on training, you'll learn how to find, download, combine, and turn data captured by satellites into ready-for-publication images. You'll learn three ways to do this by using point and click tools, command line and Google Earth Engine. 4 | 5 | [Best tutorial on using photoshop to process Landsat](https://earthobservatory.nasa.gov/blogs/elegantfigures/2013/10/22/how-to-make-a-true-color-landsat-8-image/) 6 | 7 | [Best tutorial on using landsat util to process Landsat](https://www.developmentseed.org/blog/2014/08/29/landsat-util/) 8 | 9 | ## First things first 10 | 11 | Request access to Google Earth Engine code environment 12 | 13 | https://signup.earthengine.google.com/#!/ 14 | 15 | The machines we used already had the following required software installed: 16 | * [Landsat Util](https://pythonhosted.org/landsat-util/installation.html) 17 | * [Adobe Photoshop](https://www.adobe.com/products/photoshop/free-trial-download.html) 18 | 19 | The Photoshop process can be achived in GIMP as well, but the method is very different 20 | 21 | ## Where does this data come from 22 | 23 | We didn't do this in the session but these tools provide various ways to download Landsat scenes. I think Libra is the easiest to use. 24 | 25 | * [Libra from Development Seed](https://libra.developmentseed.org) 26 | * [Landsat Util](https://pythonhosted.org/landsat-util/) 27 | * [Earth Explorer](https://earthexplorer.usgs.gov/) 28 | 29 | If you're doing this at home, you'll have a few more files in your directory than we used during the session. 30 | 31 | ## Point and click with photoshop 32 | 33 | 1. Open the three images in photoshop 34 | * You want the X_B2.tif X_B3.tif and X_B4.tif files 35 | 36 | 2. Open the channels panel 37 | 38 | 3. Click the menu button on that panel and select "Merge Channels..." 39 | 40 | 4. Select "RGB Color" from mode, and keep channels at 3, click okay 41 | 42 | 5. Specify your channels 43 | * Red: X_B4.tif 44 | * Green: X_B3.tif 45 | * Blue: X_B2.tif 46 | 47 | Click OK 48 | 49 | 6. Your image is really dark. Lighten it up by going to `Image > Adjustments > Levels` 50 | take the white carrot and drag it to the edge of the histogram, click okay 51 | 52 | 7. Open the layers panel, create a new Curves adjustment layer by clicking the half-filled circle button at the bottom of the panel. 53 | 54 | 8. Zoom to something that looks like it's white, click the white eye dropper in the panel, then click the white area perhaps a cloud or building roof. 55 | 56 | 9. In panel, select each channel from the RGB drop down, and drag the black carrot for each to the point on the histogram where the curve gets steep. 57 | 58 | 10. Switch back to the RGB view in the histogram and pull the middle of the white line up 59 | 60 | Using this method will remove all of the geographic metadata from your image. [Here is a way to get it back](https://gis.stackexchange.com/a/108703) using the command line tool GDAL. 61 | 62 | ## On the command line with landsat-util 63 | 64 | 1. Open up the command line and navigate to the folder with your images 65 | 66 | 2. run `landsat process LC80230312014138LGN00 --pansharpen --bands 432` 67 | 68 | 3. the output tells you where your file is located typically in your home directory inside of a folder at `landsat/processed/{landsat ID}` 69 | 70 | 71 | ## Using Google Earth Engine 72 | 73 | 1. Navigate to https://code.earthengine.google.com/ 74 | 75 | 2. Create a new script 76 | 77 | 3. Pick a point you want to focus on 78 | 79 | 4. Define your parameters 80 | 81 | ``` 82 | var o = { 83 | start: ee.Date('2013-01-01'), 84 | finish: ee.Date('2018-03-10'), 85 | target: geometry, 86 | cloud_cover_lt: 0.8, 87 | bands:["B4", "B3", "B2"] 88 | } 89 | ``` 90 | 91 | 5. Load all of the landsat scenes 92 | 93 | ``` 94 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 95 | ``` 96 | 97 | 6. Filter to the one that is over your point 98 | 99 | ``` 100 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 101 | .filterBounds(o.target) 102 | 103 | ``` 104 | 105 | 106 | 7. Limit to those that have low cloud coverage 107 | 108 | ``` 109 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 110 | .filterBounds(o.target) 111 | .filterMetadata("CLOUD_COVER", "less_than", o.cloud_cover_lt) 112 | ``` 113 | 114 | 8. Pick the most recent of those 115 | 116 | ``` 117 | var scene = ee.Image(filteredCollection.sort("DATE_ACQUIRED", false).first()); 118 | ``` 119 | 120 | 9. Set your parameters based on the data 121 | 122 | You can do it this way by manually defining the extent of your data 123 | 124 | ``` 125 | var params = { 126 | bands: o.bands, 127 | max: [10000,10000,10000], 128 | min: [1000,1000,1000] 129 | } 130 | 131 | ``` 132 | 133 | 134 | More complexly you can try to do it automatically by programatically calculating the extent of your data 135 | 136 | ``` 137 | var bandMax = filteredCollection.median() 138 | .reduceRegion({ 139 | geometry: o.target, 140 | reducer: ee.Reducer.max(), 141 | scale: 60, 142 | tileScale: 16 143 | }) 144 | 145 | var bandMin = filteredCollection.median() 146 | .reduceRegion({ 147 | geometry: o.target, 148 | reducer: ee.Reducer.min(), 149 | scale: 60, 150 | tileScale: 16 151 | }) 152 | 153 | 154 | var params = { 155 | bands: o.bands, 156 | max: o.bands.map(function(b){return bandMax.get(b).getInfo() * 1.5}), 157 | min: o.bands.map(function(b){return bandMin.get(b).getInfo() * 0.15}) 158 | } 159 | 160 | ``` 161 | 162 | 10. Plot your scene in the environment 163 | 164 | ``` 165 | Map.addLayer(scene, params) 166 | ``` 167 | 168 | 11. Save to your google drive as a jpeg 169 | 170 | ``` 171 | var export_image = scene.visualize(params) 172 | 173 | Export.image.toDrive({ 174 | image: export_image, 175 | description: "my_scene_from_nicar", 176 | scale: 30, 177 | maxPixels: 240000000000 178 | }) 179 | ``` 180 | 181 | 12. Click the "Run" button to exicute your code. In the "Tasks" panel clikc "Run" on the item created to begin the image export process. 182 | 183 | Exporting images from Earth Engine can be slow. To speed it up, try drawing a shape on the map viewer and using it to crop with. Then update the export section to look a like this. 184 | 185 | ``` 186 | var export_image = scene.visualize(params) 187 | 188 | Export.image.toDrive({ 189 | image: export_image, 190 | description: "my_scene_from_nicar", 191 | scale: 30, 192 | region: geometry, #make sure this matches the name of whatever shape you drew 193 | maxPixels: 240000000000 194 | }) 195 | ``` 196 | 197 | 198 | ## Now what? 199 | 200 | These are some stories that have used Landsat imagery to various ends. Some simply make use of true-color images like we made here. Some combine bands that capture reflections that are invisible to humans to detect vegetation health or highlight land use. 201 | 202 | * [The island Bangladesh is thinking of putting refugees on is hardly an island at all](https://qz.com/1075444/the-island-bangladesh-is-thinking-of-putting-refugees-is-hardly-an-island-at-all/) by Quartz 203 | * [Who is the Wet Prince of Bel Air? Here are the likely culprits](https://www.revealnews.org/article/who-is-the-wet-prince-of-bel-air-here-are-the-likely-culprits/) by Reveal 204 | * [Welcome to Fabulous Las Vegas: While supplies last](https://projects.propublica.org/las-vegas-growth-map/) by Propublica 205 | * [A Rogue State Along Two Rivers](https://www.nytimes.com/interactive/2014/07/03/world/middleeast/syria-iraq-isis-rogue-state-along-two-rivers.html) by The New York Times 206 | 207 | --------------------------------------------------------------------------------