お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、アクセスを維持するために
非商用目的での利用資格を確認する必要があります。2025 年 9 月 26 日までに確認が完了していない場合、アクセスが保留されることがあります。
ee.FeatureCollection.randomPoints
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
指定されたジオメトリ内で均一にランダムな点を生成します。ジオメトリが 2 次元(ポリゴンまたはマルチポリゴン)の場合、返されるポイントは球の特定の領域に均等に分布します。ジオメトリが 1 次元(LineString)の場合、返されるポイントはジオメトリのエッジに沿って均等に補間されます。ジオメトリの次元が 0(ポイント)の場合、返されるポイントは入力ポイントから均一にサンプリングされます。混合ディメンションのマルチジオメトリが指定されている場合、ポイントは最もディメンションの大きいコンポーネント ジオメトリからサンプリングされます。
| 用途 | 戻り値 |
|---|
ee.FeatureCollection.randomPoints(region, points, seed, maxError) | FeatureCollection |
| 引数 | タイプ | 詳細 |
|---|
region | ジオメトリ | ポイントを生成するリージョン。 |
points | 整数、デフォルト: 1000 | 生成するポイントの数。 |
seed | 長い、デフォルト: 0 | 乱数ジェネレータのシード。 |
maxError | ErrorMargin(省略可) | 必要な再投影を実行する際に許容される最大エラー量。 |
例
コードエディタ(JavaScript)
// An ee.Geometry to constrain the geographic bounds of random points.
var region = ee.Geometry.Rectangle(
{coords: [-113.5, 40.0, -110.2, 41.9], geodesic: false});
// Generate 50 random points with the region.
var randomPoints = ee.FeatureCollection.randomPoints(
{region: region, points: 50, seed: 0, maxError: 1});
print('Random points from within the defined region', randomPoints);
Map.setCenter(-111.802, 40.979, 7);
Map.addLayer(region, {color: 'yellow'}, 'Region');
Map.addLayer(randomPoints, {color: 'black'}, 'Random points');
Python の設定
Python API とインタラクティブな開発での geemap の使用については、
Python 環境のページをご覧ください。
import ee
import geemap.core as geemap
Colab(Python)
# An ee.Geometry to constrain the geographic bounds of random points.
region = ee.Geometry.Rectangle(
coords=[-113.5, 40.0, -110.2, 41.9], proj='EPSG:4326', geodesic=False
)
# Generate 50 random points with the region.
random_points = ee.FeatureCollection.randomPoints(
region=region, points=50, seed=0, maxError=1
)
display('Random points from within the defined region', random_points)
m = geemap.Map()
m.set_center(-111.802, 40.979, 7)
m.add_layer(region, {'color': 'yellow'}, 'Region')
m.add_layer(random_points, {'color': 'black'}, 'Random points')
m
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[],["The `ee.FeatureCollection.randomPoints` function generates a specified number of random points within a given geometry. The points are uniformly distributed within the geometry's area if it's two-dimensional, along its edges if one-dimensional, or sampled from the input points if zero-dimensional. For mixed-dimension multi-geometries, points are drawn from the highest-dimension components. The user defines the `region`, the number of `points`, a random `seed`, and an optional `maxError`.\n"]]