This project visualizes known habitat observation sites and predicted similar habitat locations across Kenya using Google Earth Engine, Pandas, and Geemap.
The workflow: - Loads known positive and negative habitat sites from Excel files - Loads predicted habitat similarity points from a CSV file - Converts records into Earth Engine FeatureCollections - Styles predicted points based on Similarity Score - Displays all layers on an interactive map in Jupyter Notebook
This helps explore spatial patterns of habitat similarity and compare predicted habitats against known field observations.
- Google Earth Engine initialization and authentication
- Automatic loading of similarity prediction CSV data
- Importing known positive and negative habitat sites from Excel sheets
- Automatic column detection for longitude, latitude, and date
- Duplicate point removal
- Conversion of tabular data into Earth Engine spatial features
- Score-based styling of predicted habitat points
- Interactive geospatial visualization using Geemap
- Map legend for interpretation
- Runs inside Jupyter Notebook
- Python
- Pandas
- Google Earth Engine (earthengine-api)
- Geemap
- Jupyter Notebook
Example path:
SIMILARITY_CSV = "/Users/rs/Downloads/Kenya_Habitat_Similarity.csv"
Required columns:
- Latitude
- Longitude
- Similarity Score
Optional columns:
- Habitat ID
- Chunk Index
Example path:
FILE_1 = "/Users/rs/Downloads/positives & negatives kenya.xlsx"
Expected sheets:
- Positives
- Negatives
Example path:
FILE_2 = "/Users/rs/Downloads/Kenya.xlsx"
Expected sheets:
- Positive Sites
- Negatve Sites
Note: The sheet name "Negatve Sites" must match the Excel sheet name used in the script.
The script produces an interactive map displaying:
- Blue points → Known positive habitat sites
- Black points → Known negative habitat sites
- Colored points → Predicted similar habitats
Similarity color classes:
Similarity Score Color Meaning
≥ 97 Dark Green Very high similarity 94--96.99 Lime Green High similarity 91--93.99 Orange Moderate similarity 88--90.99 Red Lower similarity
Install required packages:
pip install pandas geemap earthengine-api openpyxl
Authenticate Earth Engine:
import ee
ee.Authenticate()Initialize with project:
PROJECT_ID = "interpolated"
ee.Initialize(project=PROJECT_ID)- Open the script in Jupyter Notebook
- Update file paths if necessary
- Run the cells sequentially
- The interactive map will display with:
MapThe script authenticates and initializes the Earth Engine API.
Reads similarity predictions from CSV and known sites from Excel sheets.
Column names are standardized to identify longitude, latitude, date, and site ID.
Invalid coordinates are removed and duplicate points are dropped.
Kenya's national boundary is obtained from:
FAO/GAUL/2015/level0
All rows are converted into spatial features using Earth Engine.
Predicted points are colored based on similarity score thresholds.
Layers are added to the map including:
- Kenya boundary
- Known positive sites
- Known negative sites
- Predicted similar habitats
- Habitat similarity analysis
- Ecological site comparison
- Environmental suitability visualization
- Validation of predicted habitat clusters
- Spatial comparison between observed and predicted habitats
This module visualizes known habitat observation sites and predicted environmentally similar locations across Italy using Google Earth Engine, Pandas, and Geemap.
The workflow:
- Loads known habitat observation sites from an Excel dataset
- Generates background sampling points across Italy
- Extracts environmental predictors from Sentinel-2 satellite imagery
- Trains a Random Forest model to identify environmental similarity
- Displays predicted habitat similarity across Italy on an interactive map
This allows exploration of spatial patterns in environmental similarity and comparison between known observation sites and predicted suitable locations.
- Google Earth Engine initialization and authentication
- Automatic loading of habitat observation coordinates from Excel
- Generation of pseudo-absence background points
- Sentinel-2 environmental predictor extraction
- Terrain feature integration (elevation and slope)
- Random Forest habitat similarity modeling
- Interactive geospatial visualization using Geemap
- Map legend and layered visualization
- Runs inside Jupyter Notebook
- Python
- Pandas
- Google Earth Engine (earthengine-api)
- Geemap
- Jupyter Notebook
- Sentinel-2 satellite imagery
- NASA DEM terrain dataset
Example path:
FILE_ITALY = "/Users/rs/Downloads/ITALY KML.xlsx"
Required columns:
- Longitude
- Latitude
Example columns detected automatically:
- Longitudes
- Latitudes
The script automatically standardizes column names and removes invalid or duplicate coordinates.
The script produces an interactive map displaying:
- Red points → Known habitat observation sites
- Blue points → Background sampling points
- Colored raster layer → Predicted environmental similarity
Probability map colors:
| Probability | Color |
|---|---|
| Low | Black |
| Moderate | Purple / Cyan |
| High | Yellow |
| Very High | Red |
The map also includes a distance-from-training layer to indicate areas farther from known observations.
Install required packages:
pip install pandas geemap earthengine-api openpyxl
Authenticate Earth Engine:
import ee
ee.Authenticate()Initialize with project:
PROJECT_ID = "interpolated"
ee.Initialize(project=PROJECT_ID)- Open the notebook or script in Jupyter Notebook
- Update file paths if necessary
- Run the cells sequentially
- The interactive map will display with:
MapThe script initializes the Earth Engine API and authenticates the user.
Coordinates are loaded from an Excel dataset containing Italy observation sites.
Column names are cleaned and standardized to detect:
- longitude
- latitude
- site ID
- invalid coordinates are removed
- duplicate observation points are dropped
Italy's national boundary is obtained from:
FAO/GAUL/2015/level0
This defines the region used for environmental prediction.
Since the dataset contains presence-only observations, the script generates pseudo-absence background points randomly across Italy while avoiding areas near known observation sites.
Predictors are generated from Sentinel-2 imagery and terrain datasets.
Environmental variables include:
- B2, B3, B4, B8, B11, B12 spectral bands
- NDVI vegetation index
- NDWI water index
- MNDWI water detection index
- NBR vegetation disturbance index
- Elevation
- Terrain slope
A Random Forest classifier is trained using environmental predictors from:
- known observation sites
- background points
The dataset is split into:
- 70% training
- 30% testing
Model performance is evaluated using:
- Accuracy
- Precision
- Recall
- F1 Score
- Cohen’s Kappa
- Confusion matrix
These metrics help assess how well the model distinguishes observation sites from background environmental conditions.
The trained model is applied across Italy to produce:
- Habitat classification layer
- Habitat probability surface
- Distance-from-training diagnostic layer
These layers estimate locations with environmental conditions similar to the known observation sites.
This module can be used for:
- Habitat similarity analysis
- Environmental suitability visualization
- Spatial comparison between observed and predicted sites
- Ecological site exploration
- Remote sensing–based habitat modeling
This model currently uses presence-only observations with pseudo-absence background sampling.
Therefore:
- predictions represent environmental similarity estimates
- results should be interpreted cautiously when extrapolating across large areas
For improved modeling, future work could include:
- additional observation sites
- true absence locations
- spatial cross-validation
- integration of climate or soil datasets
Potential enhancements include:
- exporting maps to HTML
- adding interactive point popups
- clustering dense observation points
- filtering predictions by probability threshold
- integrating climate or land cover layers
- adding regional or provincial boundaries
This module extends the Interpolators project, which includes similar habitat similarity modeling workflows for multiple regions.
The Kenya module visualizes known sites and predicted habitat similarity across Kenya, while the Italy module demonstrates how the same modeling pipeline can be adapted to different geographic regions.
Rishil Shah University of South Florida
Focus areas:
- Machine Learning
- Geospatial AI
- Remote Sensing
- Environmental Modeling