お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.FeatureCollection.runBigQuery
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
BigQuery クエリを実行し、結果を取得して FeatureCollection として表示します。
用途 | 戻り値 |
---|
ee.FeatureCollection.runBigQuery(query, geometryColumn, maxBytesBilled) | FeatureCollection |
引数 | タイプ | 詳細 |
---|
query | 文字列 | BigQuery リソースに対して実行する GoogleSQL クエリ。 |
geometryColumn | 文字列、デフォルト: null | メインの特徴ジオメトリとして使用する列の名前。指定しない場合、最初のジオメトリ列が使用されます。 |
maxBytesBilled | 長い値、デフォルト: 100000000000 | クエリの処理中に課金される最大バイト数。この上限を超える BigQuery ジョブは失敗し、請求は発生しません。 |
例
コードエディタ(JavaScript)
// Get places from Overture Maps Dataset in BigQuery public data.
Map.setCenter(-3.69, 40.41, 12)
var mapGeometry= ee.Geometry(Map.getBounds(true)).toGeoJSONString();
var sql =
"SELECT geometry, names.primary as name, categories.primary as category "
+ " FROM bigquery-public-data.overture_maps.place "
+ " WHERE ST_INTERSECTS(geometry, ST_GEOGFROMGEOJSON('" + mapGeometry+ "'))";
var features = ee.FeatureCollection.runBigQuery({
query: sql,
geometryColumn: 'geometry'
});
// Display all relevant features on the map.
Map.addLayer(features,
{'color': 'black'},
'Places from Overture Maps Dataset');
// Create a histogram of the categories and print it.
var propertyOfInterest = 'category';
var histogram = features.filter(ee.Filter.notNull([propertyOfInterest]))
.aggregate_histogram(propertyOfInterest);
print(histogram);
// Create a frequency chart for the histogram.
var categories = histogram.keys().map(function(k) {
return ee.Feature(null, {
key: k,
value: histogram.get(k)
});
});
var sortedCategories = ee.FeatureCollection(categories).sort('value', false);
print(ui.Chart.feature.byFeature(sortedCategories).setChartType('Table'));
Python の設定
Python API とインタラクティブな開発での geemap
の使用については、
Python 環境のページをご覧ください。
import ee
import geemap.core as geemap
Colab(Python)
import json
import pandas as pd
# Get places from Overture Maps Dataset in BigQuery public data.
location = ee.Geometry.Point(-3.69, 40.41)
map_geometry = json.dumps(location.buffer(5e3).getInfo())
sql = f"""SELECT geometry, names.primary as name, categories.primary as category
FROM bigquery-public-data.overture_maps.place
WHERE ST_INTERSECTS(geometry, ST_GEOGFROMGEOJSON('{map_geometry}'))"""
features = ee.FeatureCollection.runBigQuery(
query=sql, geometryColumn="geometry"
)
# Display all relevant features on the map.
m = geemap.Map()
m.center_object(location, 13)
m.add_layer(features, {'color': 'black'}, 'Places from Overture Maps Dataset')
display(m)
# Create a histogram of the place categories.
property_of_interest = 'category'
histogram = (
features.filter(
ee.Filter.notNull([property_of_interest])
).aggregate_histogram(property_of_interest)
).getInfo()
# Display the histogram as a pandas DataFrame.
df = pd.DataFrame(list(histogram.items()), columns=['category', 'frequency'])
df = df.sort_values(by=['frequency'], ascending=False, ignore_index=True)
display(df)
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-25 UTC。"],[],[]]