ประกาศ: โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ee.FeatureCollection.runBigQuery จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เรียกใช้การค้นหา BigQuery, ดึงข้อมูลผลลัพธ์ และแสดงผลลัพธ์เป็น FeatureCollection
| การใช้งาน | การคืนสินค้า |
|---|
ee.FeatureCollection.runBigQuery(query, geometryColumn, maxBytesBilled) | FeatureCollection |
| อาร์กิวเมนต์ | ประเภท | รายละเอียด |
|---|
query | สตริง | การค้นหา GoogleSQL ที่จะดำเนินการกับทรัพยากร BigQuery |
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"],[],[]]