└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Creating your first satellite image 2 | 3 | ## http://bit.ly/nicar19-landsat 4 | 5 | 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. 6 | 7 | [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/) 8 | 9 | [Best tutorial on using landsat util to process Landsat](https://www.developmentseed.org/blog/2014/08/29/landsat-util/) 10 | 11 | [Best rundown of using satellites for journalism](https://gist.github.com/briantjacobs/ae5510ca84ef172b2f5f) 12 | 13 | ## First things first 14 | 15 | Request access to Google Earth Engine code environment 16 | 17 | https://signup.earthengine.google.com/#!/ 18 | 19 | The machines we used already had the following required software installed: 20 | * [Landsat Util](https://pythonhosted.org/landsat-util/installation.html) 21 | * [GIMP](https://www.gimp.org/) 22 | 23 | The GIMP process can be achived in Photoshop as well, the method is similar. I find the Photoshop way easier. 24 | 25 | ## Where does this data come from 26 | 27 | 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. 28 | 29 | * [Libra from Development Seed](https://libra.developmentseed.org) 30 | * [Landsat Util](https://pythonhosted.org/landsat-util/) 31 | * [Earth Explorer](https://earthexplorer.usgs.gov/) 32 | 33 | ## Point and click with GIMP 34 | 35 | 1. Open the three images in GIMP 36 | * You want the XXX_B2.tif XXX_B3.tif and XXX_B4.tif files 37 | 38 | 2. Open the Compose panel under `Colors > Components > Compose` 39 | 40 | 3. Select "RGB" in Color Model 41 | 42 | 4. 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 `Colors > Levels` 50 | take the white carrot and drag it to the edge of the histogram 51 | 52 | 7. From the set of eyedropper buttons on the bottom right of the panel, select the middle one, "Pick gray point" 53 | 54 | 8. Zoom into your image and find a cloud or white roofed building, click it. Click "OK" in the Levels panel 55 | 56 | 9. Open the Curves panel `Colors > Curves` 57 | 58 | 9. In panel, select each channel from the Channel drop down, and drag the dot on the bottom left for each to the point on the histogram where the curve gets steep. 59 | 60 | 10. Switch back to the Value view in the histogram and pull the middle of the black line up. Click OK 61 | 62 | 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. 63 | 64 | ## On the command line with landsat-util 65 | 66 | 1. Open up the command line and navigate to the project folder 67 | 68 | 2. run `landsat process LC08_L1TP_041036_20190122_20190122_01_RT --pansharpen --bands 432` 69 | 70 | 3. the output tells you where your file is located typically in your home directory inside of a folder at `landsat/processed/{landsat ID}` 71 | 72 | 73 | ## Using Google Earth Engine 74 | 75 | 1. Navigate to https://code.earthengine.google.com/ 76 | 77 | 2. Create a new script 78 | 79 | 3. Pick a point you want to focus on 80 | 81 | 4. Define your parameters 82 | 83 | ```javascript 84 | var o = { 85 | start: ee.Date('2013-01-01'), 86 | finish: ee.Date('2019-03-09'), 87 | target: geometry, 88 | cloud_cover_lt: 0.8, 89 | bands:["B4", "B3", "B2"] 90 | } 91 | ``` 92 | 93 | 5. Load all of the landsat scenes 94 | 95 | ```javascript 96 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 97 | ``` 98 | 99 | 6. Filter to the one that is over your point 100 | 101 | ```javascript 102 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 103 | .filterBounds(o.target) 104 | 105 | ``` 106 | 107 | 108 | 7. Limit to those that have low cloud coverage 109 | 110 | ```javascript 111 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 112 | .filterBounds(o.target) 113 | .filterMetadata("CLOUD_COVER", "less_than", o.cloud_cover_lt) 114 | ``` 115 | 116 | 8. Limit to captures of during daylight 117 | 118 | ```javascript 119 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 120 | .filterBounds(o.target) 121 | .filterMetadata("CLOUD_COVER", "less_than", o.cloud_cover_lt) 122 | .filterMetadata("SUN_ELEVATION", "greater_than", 0) 123 | ``` 124 | 125 | **Code Check** 126 | Right now your script should look like this 127 | ```javascript 128 | var o = { 129 | start: ee.Date('2013-01-01'), 130 | finish: ee.Date('2019-03-09'), 131 | target: geometry, 132 | cloud_cover_lt: 0.8, 133 | bands:["B4", "B3", "B2"] 134 | } 135 | 136 | var filteredCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT") 137 | .filterBounds(o.target) 138 | .filterMetadata("CLOUD_COVER", "less_than", o.cloud_cover_lt) 139 | .filterMetadata("SUN_ELEVATION", "greater_than", 0) 140 | ``` 141 | 142 | **Okay back to it...** 143 | 144 | 9. Pick the most recent of of your collection 145 | 146 | ```javascript 147 | var scene = ee.Image(filteredCollection.sort("DATE_ACQUIRED", false).first()); 148 | ``` 149 | 150 | 10. Set your parameters based on the data 151 | 152 | You can do it this way by manually defining the extent of your data 153 | 154 | ```javascript 155 | var params = { 156 | bands: o.bands, 157 | max: [10000,10000,10000], 158 | min: [1000,1000,1000] 159 | } 160 | 161 | ``` 162 | 163 | 164 | More complexly you can try to do it automatically by programatically calculating the extent of the data in your target area 165 | 166 | ```javascript 167 | var bandMax = filteredCollection.median() 168 | .reduceRegion({ 169 | geometry: o.target, 170 | reducer: ee.Reducer.percentile([99]), 171 | scale: 60, 172 | tileScale: 16 173 | }) 174 | 175 | var bandMin = filteredCollection.median() 176 | .reduceRegion({ 177 | geometry: o.target, 178 | reducer: ee.Reducer.percentile([1]), 179 | scale: 60, 180 | tileScale: 16 181 | }) 182 | 183 | 184 | var params = { 185 | bands: o.bands, 186 | max: bandMax.values(o.bands).getInfo(), 187 | min: bandMin.values(o.bands).getInfo() 188 | } 189 | 190 | ``` 191 | 192 | 11. Plot your scene in the environment 193 | 194 | ```javascript 195 | Map.addLayer(scene, params) 196 | ``` 197 | 198 | 12. Save to your google drive as a jpeg 199 | 200 | ```javascript 201 | var export_image = scene.visualize(params) 202 | 203 | Export.image.toDrive({ 204 | image: export_image, 205 | description: "my_scene_from_nicar", 206 | scale: 30, 207 | maxPixels: 240000000000 208 | }) 209 | ``` 210 | 211 | 13. Click the "Run" button to exicute your code. In the "Tasks" panel clikc "Run" on the item created to begin the image export process. 212 | 213 | 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. 214 | 215 | ```javascript 216 | var export_image = scene.visualize(params) 217 | 218 | Export.image.toDrive({ 219 | image: export_image, 220 | description: "my_scene_from_nicar", 221 | scale: 30, 222 | region: geometry, #make sure this matches the name of whatever shape you drew 223 | maxPixels: 240000000000 224 | }) 225 | ``` 226 | 227 | 228 | ## Now what? 229 | 230 | 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. 231 | 232 | * [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 233 | * [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 234 | * [Welcome to Fabulous Las Vegas: While supplies last](https://projects.propublica.org/las-vegas-growth-map/) by Propublica 235 | * [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 236 | 237 | **[Sign Up for the Space Journos Slack](https://join.slack.com/t/space-journos/shared_invite/enQtNTcxMjkxMDA2Mjc0LWE3OGRkYTlkN2E5OWEyYTVmZmY0YTBjY2I2OGNjMjc1NGRmNTI2NGFkYjExMGI2ZjVmNmEyYzllOTAxNzczNDk)** 238 | 239 | ## Two Resources during breaking news events 240 | [Digital Globe's Open Data](http://www.digitalglobe.com/opendata) 241 | [Planet Disaster Data](https://www.planet.com/disasterdata/) 242 | 243 | --------------------------------------------------------------------------------