geo_s2cell_to_polygon()
計算代表 S2 資料格矩形區域的多邊形。
語法
geo_s2cell_to_polygon(
s2cell)
深入瞭解 語法慣例。
參數
名稱 | 類型 | 必要 | Description |
---|---|---|---|
s2cell | string |
✔️ | S2 單元格令牌值,因為它是由 geo_point_to_s2cell () 計算而來。 S2 資料格語彙基元最大字串長度是 16 個字元。 |
傳回
GeoJSON 格式和動態資料類型的多邊形。 如果 s2cell 無效,查詢會產生 Null 結果。
注意
S2 資料格邊緣是球形測地線。
範例
print s2cellPolygon = geo_s2cell_to_polygon("89c259")
輸出
s2cellPolygon |
---|
{ "type": "Polygon", "coordinates": [[[-74.030012249838478, 40.8012684339439], [-74.030012249838478, 40.7222262918358], [-73.935982114337421, 40.708880489804564], [-73.935982114337421, 40.787917134506841], [-74.030012249838478, 40.8012684339439]]] } |
下列範例會組合 S2 資料格多邊形的 GeoJSON 幾何集合。
datatable(lng:real, lat:real)
[
-73.956683, 40.807907,
-73.916869, 40.818314,
-73.989148, 40.743273,
]
| project s2_hash = geo_point_to_s2cell(lng, lat, 10)
| project s2_hash_polygon = geo_s2cell_to_polygon(s2_hash)
| summarize s2_hash_polygon_lst = make_list(s2_hash_polygon)
| project bag_pack(
"type", "Feature",
"geometry", bag_pack("type", "GeometryCollection", "geometries", s2_hash_polygon_lst),
"properties", bag_pack("name", "S2 Cell polygons collection"))
輸出
資料行1 |
---|
{ "type": "Feature", "geometry": {"type": "GeometryCollection", "geometries": [ {"type": "Polygon", "coordinates": [[[-74.030012249838478, 40.880202851376716], [-74.030012249838478, 40.8012684339439], [-73.935982114337421, 40.787917134506841], [-73.935982114337421, 40.866846163445771], [-74.030012249838478, 40.880202851376716]]]}, {"type": "Polygon", "coordinates": [[[-73.935982114337421, 40.866846163445771], [-73.935982114337421, 40.787917134506841], [-73.841906340776248, 40.774477568182071], [-73.841906340776248, 40.853401155678846], [-73.935982114337421, 40.866846163445771]]]}, {"type": "Polygon", "coordinates": [[[-74.030012249838478, 40.8012684339439], [-74.030012249838478, 40.7222262918358], [-73.935982114337421, 40.708880489804564], [-73.935982114337421, 40.787917134506841], [-74.030012249838478, 40.8012684339439]]]}] }, "properties": {"name": "S2 Cell polygons collection"} } |
由於 S2 資料格語彙基元輸入不正確,下列範例會傳回 Null 結果。
print s2cellPolygon = geo_s2cell_to_polygon("a")
輸出
s2cellPolygon |
---|
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應