The geospatial industry is growing rapidly because of its ability to solve important real-world problems efficiently. Technology is advancing, and several tools and techniques are available to solve problems. Google Earth Engine can be considered as one of the popular platforms to use in this domain.
Google Earth Engine (GEE), launched by Google in 2010, is a platform where you can access more than 40 years of historical and current global satellite imagery, along with that you can visualise and analyse the satellite images. It is an effective tool for analysing global geospatial big data.
Some other cloud platforms are available for processing geospatial big data, including Amazon Web Service(AWS), and Microsoft Azure. Compared to other cloud platforms, GEE supports more types of geospatial data, and it is free to all users. Currently, there are several sectors where Google Earth Engine is used extensively to process data, such as Earth System Science, Environmental Science, Hydrology, Agriculture, Disaster Management, and Urban Studies.
The best part is that anyone with a Google account can access Google Earth Engine. Firstly, one needs to sign up to the platform with their Google account and new users will get access to the platform within 24 hrs.
Anyone can analyse the data on Google Earth Engine in two ways-, through the Javascript API via the GEE code editor, or through a Python API, geemap, a python package for interactive mapping with Google Earth Engine, that can be accessed through any Python environment such as Jupyter notebook.
This article talks about installing and accessing GEE with the Jupyter notebook.
[NOTE: Make sure Python, and Jupyter notebook are already installed in your system]
- Installing Earth Engine Python API and authenticate to Earth Engine
Firstly, we need to install the Earth Engine Python API. Use !pip install earthengine-api command to install the API, same as the figure shown below.
After installing the Earth Engine API, We need to authenticate the access to Earth Engine Server. To authenticate follow the below steps,
- Import the Earth Engine library with import ee command and authenticate with ee.Authenticate() command. When you run the code as shown below figure, a link will be generated in the output and a box where you need to enter a verification code.
- The link will redirect you to the Notebook Authenticator page to generate token. Choose a project first and then accept the cloud terms of service.
- Click on the Generate Token button, it will redirect to the page where you need to choose your Google account. Select your account, click on continue, check the boxes and click on continue.
One authorisation code will be generated, that you need to copy and paste in the Enter verification code box.
- The authentication process is done.
- Initializing the Earth Engine Python API and Importing geemap
After authentication, you need to initialize the Earth Engine API. Use ee.Initialize() command for that.
The next task is to install the geemap package. geemap is a python package for interactive mapping with Google Earth Engine. You need to install the geemap package using the !pip install geemap command.
- Creating an Interactive Map
You can add basemap with the use of the commands which are shown in the below figure, also you can use basemap[‘ROADMAP’], basemap[‘SATELLITE’] to access other Google basemaps.
4. Generating NDVI
With geemap package we can do a lot of tasks. Here I am explaining the NDVI generation process. Follow the steps in the figure shown below.
- Import the required packages. use the below commands,
import geemap
import geemap.colormaps as cm
- Next, Import the required Satellite imagery. Here I have used Sentinel-2 MSI: MultiSpectral Instrument, Level-2A data. Use the imageCollection object class to import the data.
imageCollection= ee.ImageCollection(“Satellite Image”)
- Next, import the Area of Interest (AOI) shapefile, here I have used Anantapur district of Andhra Pradesh. Use the geemap.shp_to_ee () command to import the shapefile.
Variable1= geemap.shp_to_ee(‘shapefile path/shapefile name’)
- Next, Specify the date range, select the required bands, mosaic and clip using the below commands,
Variable2=imageCollection.filterDate(‘starting date’,’ending date’).select([‘Band1′,’Band2’]).filterBounds(Variable1)
Variable3 = Variable2.mosaic().clip(Variable1)
- Next, Calculate the NDVI. Use the below command,
NDVI = Variable3.normalizedDifference([‘NIR Band’, ‘Red Band’])
- Next, add a colorbar and display the result. Use the below commands,
Map = geemap.Map()
Map.add_basemap(‘HYBRID’)
palette = cm.palettes.ndvi
vis_params ={
‘min’: -1,
‘max’: 1,
‘palette’ : palette}
Map.addLayer(NDVI,vis_params, ‘NDVI’)
Map.add_colorbar(vis_params, label=’NDVI’)
Map
Similarly, there are many other packages, functions, and methods. To explore those follow this link.
SatSure Sparta is a platform launched by SatSure with ready to analyse data available with a few clicks.
Check out our article on ‘extracting time-series data using SatSure Sparta by clicking here.
Click here for understanding how Digital Elevation Model (DEM) data can be generated using SatSure Sparta.
Written by Sudipta Mahato, Geospatial Analyst ll at SatSure.
Add comment