お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.Image.stratifiedSample
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
画像からポイントの層別ランダム サンプルを抽出します。「classBand」内で検出された一意の値ごとに、指定された数のサンプルを抽出します。抽出されたポイントごとに 1 つの Feature を含む FeatureCollection を返します。各 Feature には、入力画像のバンドごとに 1 つのプロパティがあります。特定のクラス値で使用可能なサンプル数が指定された数よりも少ない場合は、そのクラスのすべてのポイントが含まれます。classBand に整数値が含まれている必要があります。
用途 | 戻り値 |
---|
Image.stratifiedSample(numPoints, classBand, region, scale, projection, seed, classValues, classPoints, dropNulls, tileScale, geometries) | FeatureCollection |
引数 | タイプ | 詳細 |
---|
これ: image | 画像 | サンプリングする画像。 |
numPoints | Integer | 各クラスでサンプリングするデフォルトのポイント数。特定のクラスに対しては、'classValues' プロパティと 'classPoints' プロパティを使用してオーバーライドできます。 |
classBand | 文字列、デフォルト: null | 階層化に使用するクラスを含む帯域の名前。指定しない場合、入力画像の最初のバンドが使用されます。 |
region | Geometry、デフォルト: null | サンプリング元のリージョン。指定しない場合、入力画像のフットプリント全体が使用されます。 |
scale | 浮動小数点数、デフォルト: null | サンプリングする投影のメートル単位の名義尺度。デフォルトは、入力画像の最初のバンドのスケールです。 |
projection | Projection、デフォルト: null | サンプリングする投影。指定しない場合、入力画像の最初のバンドの投影が使用されます。スケールに加えて指定された場合、指定されたスケールに再スケーリングされます。 |
seed | 整数、デフォルト: 0 | サブサンプリングに使用するランダム化シード。 |
classValues | リスト、デフォルト: null | numPoints パラメータをオーバーライドするクラス値のリスト。classPoints と同じサイズであるか、null である必要があります。 |
classPoints | リスト、デフォルト: null | classValues リストの各クラスでサンプリングするクラスごとの最大ピクセル数のリスト。classValues と同じサイズにするか、null にする必要があります。 |
dropNulls | ブール値。デフォルト値は true です。 | いずれかのバンドがマスクされているピクセルをスキップします。 |
tileScale | 浮動小数点数、デフォルト: 1 | 集計タイルのサイズを縮小するために使用されるスケーリング ファクタ。tileScale を大きくすると(例: 2 または 4)を使用すると、デフォルトでメモリ不足になる計算が可能になる場合があります。 |
geometries | ブール値。デフォルト値は false です。 | true の場合、結果にはサンプリングされたピクセルごとにジオメトリが含まれます。それ以外の場合、ジオメトリは省略されます(メモリが節約されます)。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003eExtracts a stratified random sample of points from an image based on distinct class values within a specified band.\u003c/p\u003e\n"],["\u003cp\u003eReturns a FeatureCollection containing one feature per sampled point, each with properties corresponding to the image bands.\u003c/p\u003e\n"],["\u003cp\u003eAllows customization of the number of samples per class, sampling region, scale, projection, and randomization.\u003c/p\u003e\n"],["\u003cp\u003eHandles cases with insufficient samples for a class by including all available points for that class.\u003c/p\u003e\n"],["\u003cp\u003eRequires the class band to contain integer values for proper stratification.\u003c/p\u003e\n"]]],[],null,["# ee.Image.stratifiedSample\n\nExtracts a stratified random sample of points from an image. Extracts the specified number of samples for each distinct value discovered within the 'classBand'. Returns a FeatureCollection of 1 Feature per extracted point, with each feature having 1 property per band in the input image. If there are less than the specified number of samples available for a given class value, then all of the points for that class will be included. Requires that the classBand contain integer values.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| Image.stratifiedSample`(numPoints, `*classBand* `, `*region* `, `*scale* `, `*projection* `, `*seed* `, `*classValues* `, `*classPoints* `, `*dropNulls* `, `*tileScale* `, `*geometries*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|---------------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image to sample. |\n| `numPoints` | Integer | The default number of points to sample in each class. Can be overridden for specific classes using the 'classValues' and 'classPoints' properties. |\n| `classBand` | String, default: null | The name of the band containing the classes to use for stratification. If unspecified, the first band of the input image is used. |\n| `region` | Geometry, default: null | The region to sample from. If unspecified, the input image's whole footprint is used. |\n| `scale` | Float, default: null | A nominal scale in meters of the projection to sample in. Defaults to the scale of the first band of the input image. |\n| `projection` | Projection, default: null | The projection in which to sample. If unspecified, the projection of the input image's first band is used. If specified in addition to scale, rescaled to the specified scale. |\n| `seed` | Integer, default: 0 | A randomization seed to use for subsampling. |\n| `classValues` | List, default: null | A list of class values for which to override the numPoints parameter. Must be the same size as classPoints or null. |\n| `classPoints` | List, default: null | A list of the per-class maximum number of pixels to sample for each class in the classValues list. Must be the same size as classValues or null. |\n| `dropNulls` | Boolean, default: true | Skip pixels in which any band is masked. |\n| `tileScale` | Float, default: 1 | A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g., 2 or 4) may enable computations that run out of memory with the default. |\n| `geometries` | Boolean, default: false | If true, the results will include a geometry per sampled pixel. Otherwise, geometries will be omitted (saving memory). |"]]