Shapely #1 bounding box 쉽게 만들기
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 설치 ..
2022. 11. 14.
한줄 팁 - PostGIS 교차 중복된 면적 구하기
PostGIS에 저장된 폴리곤 레이어가 있다고 가정하고, 이 레이어의 feature들 중 내가 설정한 영역과 중복되는 폴리곤들의 면적을 구하는 한줄 쿼리 입니다. select pnu, ST_Area( st_intersection( geom, st_transform( st_setsrid(st_geomfromtext('POLYGON ((127.00143 37.49791, 127.00635 37.49791, 127.00635 37.50109, 127.00143 37.50109, 127.00143 37.49791))'), 4326), 3857)))as area from lp_pa_cbnd where st_intersects(geom, st_transform( st_setsrid(st_geomfromtext('P..
2022. 2. 16.