Start a team blog
Start a team blog, invite your team, and start publishing.
How to map USA states boundaries using Earth Engine Python API and Google Colab

How to map USA states boundaries using Earth Engine Python API and Google Colab

Deactivated User's photo
Deactivated User
·May 7, 2021·

1 min read

In this tutorial, we will discuss on how to map USA state boundaries using the Earth Engine Python API and Google Colab. Earth Engine is by default integrated with Google Colab so you do not need to manually install it. Rather you need to import, authenticate and initialize to start the Python API.

#Import earth engine
import ee

# Trigger the authentication flow.

# Initialize the library.

Next, lets import the USA states boundaries data from the Earth Engine data library.

# Import the Folium library.
import folium

# Define a method for displaying Earth Engine image tiles to folium map.
def add_ee_layer(self, ee_image_object, vis_params, name):
  map_id_dict = ee.Image(ee_image_object).getMapId(vis_params)
    tiles = map_id_dict['tile_fetcher'].url_format,
    attr = 'Map Data &copy; <a href="https://earthengine.google.com/">Google Earth Engine</a>',
    name = name,
    overlay = True,
    control = True

# Add EE drawing method to folium.
folium.Map.add_ee_layer = add_ee_layer

# Create a folium map object.
my_map = folium.Map(location=[37.649, -99.844], zoom_start = 4)

# Add the layer to the map object.
my_map.add_ee_layer(image, {'palette': '00FFFF'}, 'TIGER/2018/States')

# Add a layer control panel to the map.

# Display the map.

Check out the video tutorial below.