> For the complete documentation index, see [llms.txt](https://isbm.savimbo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://isbm.savimbo.com/methodology/ja/fu-lu/gpunssukdotonosanpuru.md).

# 付録G：オープンソースコードと算定のサンプル

生物多様性クレジット算出のためのオープンソースコードは、一般に以下で公開されています。 [Savimbo GitHub](https://github.com/savimbo).&#x20;

当社は、2024年に生物多様性認証を開始した後、無料の Airtable データベースから、またはそこへ自動でクレジット付与できるインターフェースを備えた、IP および LC プロジェクトでも利用しやすい形に本コードをする意図を有しています。無料の Airtable [登録 ](https://airtable.com/invite/r/fxsn6mcE)は現在利用可能です。IP プロジェクトは、このインターフェースから現在ウェイトリストに登録でき、<ops@savimbo.com> までメールで連絡することで Airtable データベースのテンプレートを入手できます。

デモ計算も利用可能です。Google Earth Engine は、気候変動に関与する先住民族グループに無料アカウントを提供すると表明しています。非商用 [登録](https://earthengine.google.com/noncommercial/) が利用可能です。&#x20;

**図11。Google Earth Engine コードサンプル**&#x20;

<figure><img src="https://lh6.googleusercontent.com/rVQ0Wv_v9_eXa7qOghqAvJhwResowct17qRiUSD-lO_eatzZqyiNhfpKmprKNcRWdVXXkv2FuYyAetkdA1BzOcf6d7EWeGqmRpKVVMGmk89gLOQd8i1K-Ia4A7ixXu0Xo2XSlovBPF8KPN24COHu6a4" alt=""><figcaption><p><em><strong>図11</strong></em>. Google Earth Engine コードサンプル</p></figcaption></figure>

コードサンプル、コードは外部レビュー中です。Google Earth Engine ではこの [リンクからアクセスできます。](https://code.earthengine.google.com/e914e4bf1b4fd252f4ad90318ca2371e) または、Savimbo GitHub ではこの [リンクからアクセスできます。](https://github.com/savimbo) 連絡先 ***ops at savimbo.co**m* コードレビューをご希望の場合。&#x20;

```markup
// plot18 ポリゴンを読み込む
var plot18_data = require("users/drea/map:plot18_data");
var plot18 = plot18_data.polygon;

// plot 面積をヘクタールで算出
var plotArea = plot18.area();
var plotAreaHectares = plotArea.divide(10000);

// ジャガーポイントを読み込む
var points_jaguar_data = require("users/drea/map:points_jaguar_data");
var puntos = points_jaguar_data.points;
var radios = [];
var sumMultipliedArea = ee.Number(0);

// 交差ポリゴンを格納する feature collection を定義する
var intersectionPolygons = ee.FeatureCollection([]);

// assignedArea 関数を定義する
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));
};

// 各ポイントのラジオとバッファを計算する
for (var i = 0; i < puntos.length; i++) {
  var point = puntos[i].geometry;
  var date = puntos[i].date;

  // 30日を差し引いて開始日を計算する
  var startDate = ee.Date(date).advance(-30, 'day');
  
  // 30日を加算して終了日を計算する
  var endDate = ee.Date(date).advance(30, 'day');
  
  // ポイントのジオメトリと日付を属性とする feature を作成する
  var feature = ee.Feature(point, { date: date });
  
  var pointBuffer = feature.buffer(800);
  radios.push(pointBuffer);
  
  // plot18 との交差を計算する
  var intersection = pointBuffer.intersection(plot18);
  
  // 面積をヘクタールで計算する
  var area = intersection.area().divide(10000);
  
  // 日付の月と年を取得する
  var month = ee.Date(date).get('month');
  var year = ee.Date(date).get('year');
  
  // 月と年のラベルを生成する
  var monthYearLabel = ee.String(month).cat('-').cat(year).cat(' ヘクタール N°');
  
  // 現在のポイントについて plot18 との交差を計算する
  var intersectionPlot18 = pointBuffer.intersection(plot18);
  
  // plot18 との交差の面積をヘクタールで計算する
  var intersectionArea = intersectionPlot18.area().divide(10000);
  var multipliedArea = intersectionArea.multiply(60);
  
  // multipliedArea を合計に加算する
  sumMultipliedArea = sumMultipliedArea.add(multipliedArea);
  
  // ジャガーの期間を定義する
  var jaguarRange = endDate.difference(startDate, 'day');
  
 // ジャガーの期間の各日に intersectionArea の値を割り当てる
  var assignedArea = ee.FeatureCollection(ee.List.sequence(0, jaguarRange.subtract(1)).map(assignedAreaFunction));
  
  // 各ポイントの結果を出力する
  print('ジャガー:', i + 1);
  print('画像取得日:', date);
  print('開始日:', startDate.format('YYYY-MM-dd'));
  print('終了日:', endDate.format('YYYY-MM-dd'));
  print('1日当たりの総交差面積（ヘクタール）:', intersectionArea);
  print('交差面積 × 60 の値:', multipliedArea);
  print('1日当たりの割当面積:', assignedArea);
  print('----------------------');
  
  // 現在のポイントのバッファを青色で地図に追加する
  Map.addLayer(pointBuffer, { color: 'blue' }, 'ラジオ ' + (i + 1));
  
  // 交差ジオメトリを intersectionPolygons に追加する
  intersectionPolygons = intersectionPolygons.merge(intersection);
}

// 重複を避けるためにポリゴンの union を実行する
var unionPolygons = intersectionPolygons.union();

// 重複のない交差の総面積を計算する
var totalIntersectionArea = unionPolygons.geometry().area().divide(10000);

// 結果を表示する
print('総交差面積（ヘクタール）:', totalIntersectionArea);
print('plot18 の面積（ヘクタール）:', plotAreaHectares);
print('交差面積の合計 × 60日（ヘクタール）:', sumMultipliedArea);

// plot18 レイヤーを地図に追加する
Map.addLayer(plot18, { color: 'gold' }, "plot18");
Map.centerObject(plot18);

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://isbm.savimbo.com/methodology/ja/fu-lu/gpunssukdotonosanpuru.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
