본문 바로가기

전체 글21

언더바가 포함된것 검색할때 sql Arcgis "SIG_CD" like '%\_%' escape '\' \ = 역슬래시 2021. 12. 6.
Java) Spring Transaction Rollback 시키기 예제 두 테이블의 행동이 똑같이 일어나야할때 서비스단에서 예외 발생시키기 - 업데이트는 에러가 발생해도 다음 코드로 진행 되어 마지막에 리턴값을 받아서 하나라도 에러 발생시 롤백 시키도록 활용하였다. @Override public int updateStatus(Map option) { int msg = 0; try { //(업데이트 실패시 0 , 성공시 1 반환) // 첫번째 업데이트 int result = devDao.updateTest(option); // 두번째 업데이트 int result1 = devDao.updateTest2(option); // 둘중 하나에서 에러 발생시 강제로 에러발생시켜 롤백 시킴 if (result == 0 || result1 == 0) { // msg = 0; throw ne.. 2021. 8. 20.
Qgis&Arcgis) arcpy 홀 폴리곤 삭제 (remove hole polygon) arcpy에서 지오메트리를 이용하여 쉽게 홀 폴리곤을 없앨수 있습니다. 홀 폴리곤의 지오메트리는 None 값을 반환합니다. import arcpy import os arcpy.env.overwriteOutput = True # 좌표정보 sr = arcpy.Describe('layer').spatialReference with arcpy.da.UpdateCursor('layer','SHAPE@')as cursor: for row in cursor: arr = arcpy.Array() # 폴리곤 지오메트리 read for i in range(row[0].partCount): part = row[0].getPart(i) arcpy.AddMessage('-- part '+str(i)) for pt in part.. 2021. 8. 15.
Qgis&Arcgis) arcpy 벡터의 외적을 이용한 두 벡터의 교차점 구하기 # 벡터의 외적 def cross_product(x0,y0,x1,y1, x2,y2,x3,y3): val = (x1-x0)*(y3-y2) - (y1-y0)*(x3-x2) return val # 두 벡터의 교차점 def intersection_point(x0,y0,x1,y1, x2,y2,x3,y3, val): pre = x1*y0 - y1*x0 post = x3*y2 - y3*x2 x = (pre * (x3-x2) - (x1-x0) * post) / val y = (pre * (y3-y2) - (y1-y0) * post) / val return x,y if __name__ == '__main__': for idx, row in enumaerat(arcpy.da.SearchCursor("폴리라인","SHAPE.. 2021. 8. 10.