공간정보/Shapely(Python)
Shapely #1 bounding box 쉽게 만들기
요긴소프트
2022. 11. 14. 12:50
728x90
반응형
shapely에서 bouding box 쉽게 만들기
# shapely 설치후 box 클래스 import
from shapely.geometry import box
b = box(0.0, 0.0, 200, 100)
print(b.wkt)
# print 결과 : POLYGON ((200 0, 200 100, 0 100, 0 0, 200 0))
list(b.exterior.coords)
# 결과 : [(200.0, 0.0), (200.0, 100.0), (0.0, 100.0), (0.0, 0.0), (200.0, 0.0)]
# 기타 도형의 bounding box로 shapely.geometry.box 폴리곤 만들기
pbox = box(*myPolygon.bounds, ccw=True)
※ shapely 설치 : https://pypi.org/project/Shapely/
Shapely
Geometric objects, predicates, and operations
pypi.org
728x90
반응형