Appendix G: Sample open-source code and calculation

Google Earth Engine demo and access to ISBM code on Savimbo GitHub

Open-source code for biodiversity credit calculations is available to the public at the Savimbo GitHub.

We have the intent of making this code easier to use and available to IP and LC projects with an interface which can auto-credit from, and to, a free Airtable database after we begin biodiversity certification in 2024. Free Airtable sign up is available now. IP projects can signup for the waitlist on this interface now and obtain Airtable database templates by emailing

Demo calculations are also available on Google Earth Engine has pledged to provide free accounts to Indigenous groups involved in climate change. Noncommercial sign up is available.

Figure 11. Google Earth Engine code sample

Code sample, code under external revision. Can be accessed through Google Earth Engine at this link. Or in Savimbo GitHub at this link. Contact ops at if you would like to be a code reviewer.

// Load plot18 polygon
var plot18_data = require("users/drea/map:plot18_data");
var plot18 = plot18_data.polygon;

// Calculate plot area in hectare
var plotArea = plot18.area();
var plotAreaHectares = plotArea.divide(10000);

// Load jaguar points
var points_jaguar_data = require("users/drea/map:points_jaguar_data");
var puntos = points_jaguar_data.points;
var radios = [];
var sumMultipliedArea = ee.Number(0);

// Define a feature collection to store intersection polygons
var intersectionPolygons = ee.FeatureCollection([]);

// Define the assignedArea function
var assignedAreaFunction = function(offset) {
  var day = startDate.advance(offset, 'day');
  var dayString = day.format('YYYY-MM-dd');
  var feature = ee.Feature(null, { date: dayString, intersectionArea: intersectionArea });
  return feature.set('date_area', ee.String(dayString).cat(' - ').cat(intersectionArea));

// Calculate radios and buffers for each point
for (var i = 0; i < puntos.length; i++) {
  var point = puntos[i].geometry;
  var date = puntos[i].date;

  // Calculate the start date by subtracting 30 days
  var startDate = ee.Date(date).advance(-30, 'day');
  // Calculate the end date by adding 30 days
  var endDate = ee.Date(date).advance(30, 'day');
  // Create a feature with the point geometry and date as properties
  var feature = ee.Feature(point, { date: date });
  var pointBuffer = feature.buffer(800);
  // Calculate intersection with plot18
  var intersection = pointBuffer.intersection(plot18);
  // Calculate area in hectares
  var area = intersection.area().divide(10000);
  // Get the month and year of the date
  var month = ee.Date(date).get('month');
  var year = ee.Date(date).get('year');
  // Generate a label for the month and year
  var monthYearLabel = ee.String(month).cat('-').cat(year).cat(' Hectarias N°');
  // Calculate intersection with plot18 for the current point
  var intersectionPlot18 = pointBuffer.intersection(plot18);
  // Calculate area in hectares for the intersection with plot18
  var intersectionArea = intersectionPlot18.area().divide(10000);
  var multipliedArea = intersectionArea.multiply(60);
  // Add multipliedArea to the sum
  sumMultipliedArea = sumMultipliedArea.add(multipliedArea);
  // Define the jaguar range of dates
  var jaguarRange = endDate.difference(startDate, 'day');
 // Assign intersectionArea value to each day of the jaguar range
  var assignedArea = ee.FeatureCollection(ee.List.sequence(0, jaguarRange.subtract(1)).map(assignedAreaFunction));
  // Print the results for each point
  print('Jaguar:', i + 1);
  print('Date of image capture:', date);
  print('Start Date:', startDate.format('YYYY-MM-dd'));
  print('End Date:', endDate.format('YYYY-MM-dd'));
  print('Total Intersection Area per day in hectares:', intersectionArea);
  print('Multiplied Intersection Area * 60:', multipliedArea);
  print('Assigned Area per day:', assignedArea);
  // Add the current point buffer to the map in blue color
  Map.addLayer(pointBuffer, { color: 'blue' }, 'Radio ' + (i + 1));
  // Add the intersection geometry to intersectionPolygons
  intersectionPolygons = intersectionPolygons.merge(intersection);

// Perform polygon unions to avoid duplicates
var unionPolygons = intersectionPolygons.union();

// Calculate the total area of intersections without duplicates
var totalIntersectionArea = unionPolygons.geometry().area().divide(10000);

// Display the results
print('Total intersection area hectares:', totalIntersectionArea);
print('Plot18 area hectares:', plotAreaHectares);
print('Sum of Multiplied Intersection Area hectares * 60 days:', sumMultipliedArea);

// Add the plot18 layer to the map
Map.addLayer(plot18, { color: 'gold' }, "plot18");

Last updated


© 2023 Savimbo Inc. All rights reserved.