How to Extract Pixel Values Interactively and Export as Shapefile and CSV using geemap package

GeoSense ✅
3 min readApr 5

If you work with geospatial data, chances are you need to extract pixel values from a raster layer at some point. This can be a tedious and time-consuming task, but fortunately, geemap package can make it much easier. In this tutorial, we will explore how to use geemap package to extract pixel values interactively and export them as a shapefile and CSV file.

from geemap website

What is geemap package?

geemap is a Python package that provides a simple yet powerful way to interactively visualize and analyze geospatial data using Google Earth Engine (GEE) API. It provides a user-friendly interface that allows you to perform various geospatial tasks without requiring you to write complex GEE code.

geemap package can be installed using pip, and it requires a Google Earth Engine account to be able to access GEE data. Once you have installed and authenticated geemap, you can start exploring its many features.

Install from PyPI

Geemap is available on PyPI. To install geemap, run this command in your terminal: pip install geemap

Loading and visualizing sample data using geemap

Let’s start by loading and visualizing a sample raster layer using geemap. We will use the Landsat 8 Surface Reflectance layer as an example. To load the layer, we need to specify its ID, which we can find on the GEE website.

import os
import ee
import geemap
Map = geemap.Map()
# Add Earth Engine dataset
dem = ee.Image('USGS/SRTMGL1_003')
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003')

# Set visualization parameters.
vis_params = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],

# Add Earth Engine layers to Map
landsat7, {'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200}, 'Landsat 7'
Map.addLayer(dem, vis_params, 'SRTM DEM', True, 1)

This will display the Landsat 8 layer on the map, allowing you to interact with it.

Extracting pixel values interactively using geemap

GeoSense ✅

🌏 Remote sensing | 🛰️ Geographic Information Systems (GIS) | ℹ️