Looking at the documentation for this satellite, shows that I want bands B4, B3 and B2. I want an RGB image, so I need three bands from the satellite. Generating the individual GeoTIFF files for each band Finally, I add the longitude and latitude pixel coordinates to the collection. Then I sort the collection by the percentage of cloud cover and take the first one (i.e., the image with the least amount of cloud cover). I filter by location (by passing a geometry) and by date (which can be specified on the input to my function). This ImageCollection can have many filter options to narrow down to the exact images that you desire. Through Earth Engine, you access images from a given satellite by first defining an ImageCollection. In principle, you should be able to make minimal modifications to the code I created in order to download data from your favorite satellite. Note that I have chosen to use the Sentinal satellite images, but there are MANY other satellites and datasets that you could choose from. (I also provide a few additional input options, which are explained within the comments of the code.) At the end of this post, I also walk through a simple script in a Jupyter notebook to initiate the authentication (with Google), run this Python script and download the image. This function downloads an RGB image from the Sentinal S2 Surface Reflectance satellite at the given central (lon, lat) coordinates and with a desired size (sze, in degrees), and saves the image to a GeoTIFF file with a name specified by the filename input. I created a Python script titled EarthEngineToGeoTIFF.py, which contains a single function called getSentinalS2SRImage. Here are the install commands that I used: I use Anaconda’s Python distribution, and I created a new environment to work in (which I strongly recommend). The first thing you need to do is to install the Google Earth Engine API and rasterio. I ended up piecing together methods from various tutorials with a LOT of trial and error to make this work. (I am an astronomer by training, and we generally look away from Earth!) So, as we often do, I started by scouring the internet for code snippets and advice on how to accomplish this goal. I am admittedly not an expert with GIS data. It provides RGB images at 10m resolution. My goal with this project is to download a full color (RGB) satellite image at decent resolution and save it to my computer in GeoTIFF format so that I can use it with various other mapping applications.Īfter trying a few different data sources for optical satellite images, it appears that ESA’s Sentinal S2 Surface Reflectance dataset is the best option for my typical needs. Some tutorials can be found here, and here is a helpful introduction to the API in Python. Within each dataset’s description there is a code snippet (typically in JavaScript) that shows how to access the dataset. You can find a list of available datasets here. But I’ve found that the JavaScript tutorials can also be helpful since the syntax is very similar to Python. The online documentation for Earth Engine is a bit limited, especially for Python. In order to use the API you need to sign up. There is a Python API (and a JavaScript API) to access the service, which I will use here. Google has developed a fantastic (and free) tool to access imagery from a variety of Earth-facing satellites, called Earth Engine. You can find the full code on my GitHub repo, and I’ll break it down section by section below. This time I decided to write a generalizable Python script to download satellite images, and I want to share that code with you here. In the past I’ve found various ad hoc workarounds. This is not the first time I’ve run into this issue. So, since these images exist online, I should be able to easily download a free tile image, perhaps a GeoTIFF image, centered on a major city like Chicago, right? Wrong. ![]() There are plenty of satellites in the sky mapping the Earth surface many of these make their images available for free, and of course we are all familiar with mapping utilities like Google maps. I figured that a simple Google search would easily return a place to download a ready-made image of the city with latitude and longitude embedded that I could use in my favorite geographic information system (GIS) application. Recently I went looking online for a satellite image of Chicago to use in an RCS workshop.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |