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
반응형
'공간정보 > Shapely(Python)' 카테고리의 다른 글
Shapely #3 기하 도형 그리기(Plot) (0) | 2022.11.14 |
---|---|
Shapely #2 WKT 사용 방법 (0) | 2022.11.14 |
Shapely #0 소개 및 설치 방법 (0) | 2022.11.14 |