LogoLogo
Savimbo homepageBuy creditsSpanish
  • Executive summary
  • Front Material
    • Contents
    • Index of figures
    • Index of tables
    • Acronyms and abbreviations
    • Terms and definitions
  • Getting started
  • Introduction
    • The urgency of targeted biodiversity conservation
    • Simplicity, complexity theory, and biodiversity
    • Inclusion of Indigenous Peoples and local communities by design
    • Biodiversity methodology benefits
  • Overall description
    • Objectives
    • Scope
    • Limitations
  • Project description
    • Principles
      • Principles of working with IP
    • Eligibility criteria
      • Land ownership and law
    • Additionality
    • Project boundaries
      • Spatial limits of the BCP
      • Temporal limits of the BCP
      • Grouped projects
    • Implementation plan
      • Measurement approaches
      • Indicator species observations
      • Risks and uncertainty
    • Effective participation
      • Community involvement
      • Capacity for action
      • Financial transparency
      • Safeguards checklist
  • Calculation
    • Unit calculations
    • Area calculations
    • Time calculations
    • Integrity calculations
    • Value calculations
  • Baseline assessment
    • Baseline ecosystem categorization
    • Analysis of agents and drivers of biodiversity loss
    • Baseline biodiversity (optional)
    • Baseline risk of biodiversity loss
    • Indicator species selection
    • Indicator species integrity score
  • SDG contributions
  • Monitoring plan
    • Monitoring report
    • Additional monitoring requirements
  • Authors
  • References
  • Appendices
    • Appendix A: Biodiversity methodologies comparison table
    • Appendix B: Sample legal proof of land control
    • Appendix C: Sample baseline ecosystem categorization
    • Appendix D: Species categorization of richness
    • Appendix E: Sample selection of indicator species
    • Appendix F: Sample indicator-species observations
    • Appendix G: Sample open-source code and calculation
    • Appendix H: Indigenous authors
    • Appendix I: Letters of support
      • Fernando Ayerbe, Ornithology
      • Ned Hording, Biodiversity
      • Olber Llanos, Zoologist
      • Mike McColm, Ethnology
      • Peter Thomas, Anthropologist
      • Jesús Argente, Marine biology
      • Sara Andreotti, Marine Biologist
      • Carolina Romero, Lawyer.
      • Daniel Urbano, Herpetologist
      • Ramesh Boonratana PhD, Primatologist
      • Theodore Schmitt, Conservationists
      • Anja Hutschenreiter, Ecologist and Tropical Conservationist
      • Miguel Chindoy, Indigenous leader
    • Appendix J: Sample uses of biodiversity unit
    • Appendix K: How to do FPIC
    • Appendix L: Independent Expert Panel Checklist
    • Appendix M: How to calculate a biodiversity credit by hand
    • Appendix N: How to calculate home ranges
    • Appendix O: How to calculate integrity scores
  • Document history
  • Disclaimer
Powered by GitBook
LogoLogo

Follow us

  • Twitter
  • Instagram
  • TikTok
  • LinkedIn

About Savimbo

  • Science
  • Buy credits
  • About us
  • Donate

Indigenous authors

  • Jhony Lopez
  • Fernando Lezama
  • Blog

© 2023 Savimbo Inc. All rights reserved.

On this page

Was this helpful?

  1. Appendices

Appendix G: Sample open-source code and calculation

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

PreviousAppendix F: Sample indicator-species observationsNextAppendix H: Indigenous authors

Last updated 1 year ago

Was this helpful?

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

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 is available now. IP projects can signup for the waitlist on this interface now and obtain Airtable database templates by emailing ops@savimbo.com

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

Figure 11. Google Earth Engine code sample

Figure 11. Google Earth Engine code sample
// 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);
  radios.push(pointBuffer);
  
  // 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);
  print('----------------------');
  
  // 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");
Map.centerObject(plot18);

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

link.
link.
Savimbo GitHub
sign up
sign up