다음을 통해 공유


geo_s2cell_to_polygon()

S2 셀 사각형 영역을 나타내는 다각형을 계산합니다.

Syntax

geo_s2cell_to_polygon(s2cell)

구문 규칙에 대해 자세히 알아보세요.

매개 변수

이름 형식 필수 Description
s2cell string ✔️ geo_point_to_s2cell()에서 계산한 S2 셀 토큰 값입니다. S2 셀 토큰 최대 문자열 길이는 16자입니다.

반환

GeoJSON 형식동적 데이터 형식의 다각형입니다. s2cell이 잘못된 경우 쿼리는 null 결과를 생성합니다.

참고

S2 셀 가장자리는 구형 측지식입니다.

예제

print s2cellPolygon = geo_s2cell_to_polygon("89c259")

출력

s2cellPolygon
{
"type": "Polygon",
"좌표": [[-74.030012249838478, 40.801268433943939], [-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.93598211437421, 40.787917134506841], [-73.93598211437421, 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.9359821114337421, 40.866846163445771]]]},
{"type": "Polygon", "coordinates": [[-74.030012249838478, 40.801268433943939], [-74.030012249838478, 40.7222262918358], [-73.935982114337421, 40.708880489804564], [-73.935982114337421, 40.7879171 34506841], [-74.030012249838478, 40.8012684339439]]]}]
},
"properties": {"name": "S2 Cell polygons collection"}
}

다음 예제에서는 잘못된 s2cell 토큰 입력으로 인해 null 결과를 반환합니다.

print s2cellPolygon = geo_s2cell_to_polygon("a")

출력

s2cellPolygon