你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

geo_s2cell_to_polygon()

适用于:✅Microsoft Fabric✅Azure 数据资源管理器Azure MonitorMicrosoft✅ Sentinel

计算表示 S2 单元格矩形区域的多边形。

详细了解 S2 单元格

语法

geo_s2cell_to_polygon(s2cell)

详细了解语法约定

参数

客户 类型​​ 必需 说明
s2cell string ✔️ geo_point_to_s2cell() 计算得出的 S2 单元格令牌值。 S2 单元格令牌的最大字符串长度为 16 个字符。

返回

采用 GeoJSON 格式动态数据类型的多边形。 如果 s2cel 无效,则查询会生成 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"))

输出

Column1
{
"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"}
}

以下示例由于 s2cell 令牌输入无效而返回 null 结果。

print s2cellPolygon = geo_s2cell_to_polygon("a")

输出

s2cellPolygon