[ArcObjects]여러 Geometry를 하나로 합치기(Union)

이미지
Geometry 연산 중에서 여러 Geometry를 하나의 Geometry로 합치는 과정을 일반적으로 Union이라 부른다. Union은 다음 그림과 같이 서울시의 모든 시군구 폴리곤을 하나로 합쳐 서울시경계 폴리곤을 생성하기 위해 사용될 수 있다. 이 문서는 ITopologicalOperator 인터페이스를 활용하여 Geometry를 Union하는 예를 샘플코드와 함께 제공한다. ▣ ITopologicalOperator 사용시 주의사항 High-level Geometry( point, multipoint, polyline, polygon) 에만 적용할 것 Union 대상 Geometry의 SpatialReference는 동일할 것 ▣ 기본 사용법  - 두 Geometry를 Union하는 방법 [code c#] IGeometry geometryA = GetGeometryA(); IGeometry geometryB = GetGeometryB(); ITopologicalOperator2 topoOpt = (ITopologicalOperator2)geometryA; IGeometry unionGeometry = topoOpt .Union(geometryB); [/code] ▣ ITopologicalOperator의 Union Method를 반복적으로 사용  - FeatureClass에서 검색된 Feature의 모든 Shape을 하나의 Geometry로 Union하며 Union 메쏘드를 반복적으로 수행하는 예이다. 피쳐 수가 많아지면 처리속도가 느려진다. [code c#] private IGeometry UnionGeometry(IFeatureClass featureClass, IQueryFilter queryFilter) {     ITopologicalOperator2 unionTopoOpt = null;     esriGeometryType geometryType = featureClass.ShapeType...

ITopologicalOperator

이미지
ArcObjects Geomtery 관련 인터페이스 중 Geometry를 핸들링하는 가장 중요한 인터페이스가 무엇일까? 선택하라면 아마도 ITopologicalOperator, IRelationalOperator, IProximityOperator일 것이다. ITopologicalOperator 인터페이스는 기존 Geometry 간의 위상관계를 바탕으로 새로운 Geometry 를 생성하기 위한 멤버 접근을 제공한다. ▣ Remarks - GeometryBags은 Buffer, Clip, Simplify만 지원한다. - High-level Geometry( point, multipoint, polyline, polygon) 에만 적용되어야 한다. - ITopologicalOperator를 사용할 때 Spatial reference를 설정해 주는 것이 성능면에서 효율적이다. 특히 circular arcs, bezier curves, elliptical arcs의 경우에는 더욱 그렇다. - 9.3 버전 이후에서 ITopologicalOperator5 인터페이스로 대체 및 최신 버전 사용 권장 ▣ CoClasses that implement ITopologicalOperator  - GeometryBag, MultiPatch, Multipoint, Point, Polygon, Polyline  - esriDefenseSolutions: GeoEllipse, GeoPolygon, GeoPolyline ▣ Members ○ Boundary [C#] public IGeometry Boundary {get;} Boundary는 Geometry 의 exterior의 한 부분으로 원본 Geometry 의 차원보다 한 차원 낮다. 즉, Polygon 의 Boundary는 Polygon 의 Ring을 구성하는 Polyline , Polyline 의 Boundary는 Polyline 을 구성하는 각 Path의 끝점들로 구성된 Multipoint , Mu...

IRelationalOperator

이미지
ArcObjects Geomtery 관련 인터페이스 중 Geometry를 핸들링하는 가장 중요한 인터페이스가 무엇일까? 선택하라면 아마도 ITopologicalOperator, IRelationalOperator, IProximityOperator일 것이다. 여기에서는 두 Geometry간의 공간관계를 확인하는 IRelationalOperator 인터페이스를 살펴본다. ▣ DE-9IM(Dimensionally Extended 9 Intersection Model) DE-9IM(Clementini-Matrix)은 두 Geometry간의 공간관계를 정의하는 수학적인 접근 방식으로 8가지의 공간 관계 연산자를 정의하고 있으며 ISO/TC 211 및 OGC 에서도 채택하고 있다 . 공간관계 연산은 Equal, Touches, Contains, Within, Disjoint, Crosses, Overlaps, Intersects이며 두 지리 객체의 경계(Boundary), 내부(Interior), 외부(Exterior) 사이의 교차 여 부를 판정하여 지리 객체의 관련성을 검사한다. DE-9IM은 다음의 과정을 통해 확장되었다.   - Four-Intersection Model (4IM): Boolean set of operations (considering intersections between boundary and exterior)  - Nine-Intersection Model (9IM, Egenhofer-Matrix): Egenhofer operators (taking into account exterior, interior and boundary of objects)  - Dimensionally Extended Nine-Intersection Model (DE-9IM, Clementini-Matrix ): Clementini operators using the same topological primitives as Egenh...

IProximityOperator

이미지
ArcObjects Geomtery 관련 인터페이스 중 Geometry를 핸들링하는 가장 중요한 인터페이스가 무엇일까? 선택하라면 아마도 ITopologicalOperator, IRelationalOperator, IProximityOperator일 것이다. 여기에서는 그 중 인접성과 관련된 연산을 수행하는 IProximityOperator의 메쏘드를 살펴본다. IProximityOperator 인터페이스는 두 Geometry간의 거리를 계산하거나 주어진 포인트로부터 다른 Geometry 의 가장 가까운 포인트나 가장 가까운 포인트간의 거리를 계산하는데 사용한다. ▣ CoClasses that implement IProximityOperator - BezierCurve, CircularArc, EllipticArc, Envelope, Line, Multipoint, Point, Polygon, Polyline - esriDefenseSolutions: GeoEllipse, GeoPolygon, GeoPolyline ▣ Members ① QueryNearestPoint 주어진 포인트에서 대상 Geometry 간의 가장 가까운 포인트를 쿼리(copy)한다. segment extension 옵션에 의해 가장 가까운 포인트는 Geometry 의 extension을 이용해서도 계산될 수 있다. 다음 코드에서와 같이 QuerynearestPoint를 호출하기 위해서 InputPoint( nearest Point) 는 반드시 호출하기 전에 할당할 것. [C#]public void QueryNearestPoint (IPoint p, esriSegmentExtension extension, IPoint nearest); [code c#] IPoint fromPoint = new ESRI.ArcGIS.Geometry.PointClass(); IPoint toPoint = new ESRI.ArcGIS.Geometry.PointClass(); fromPoint.PutCoords(...

Geometry 체계 이해

이미지
이 문서는 ArcObjects를 처음으로 접하는 개발자들에게 Geometry 체계에 대한 이해를 제공할 목적으로  Introduction to geometry objects 문서 중 Core Geometry Object에 대한 정보를 기술합니다. Geometry library는 Point, Multipoint, Polyline, Polygon, MultiPatch와 같은 벡터 표현을 제공하는 핵심 라이브러리이다. 지오메트리는 피쳐와 그래픽의 shape을 정의하기 위해 지오데이터베이스, 그래픽 엘리먼트 시스템에 사용된다. 또한 편집기를 위한 작업 및 피쳐를 심볼화하고 정의하기 위한 지도 심볼 시스템에도 사용된다. 공간좌표체계(Spatial reference)는 이들 지오메트리와 밀접한 관계가 있으며 ArcObjects의 거의 모든 시스템은 지오메트리와 공간참조를 어떤 방식으로든 사용하고 있다. 즉, 지오메트리와 공간좌표체계는 GIS 엔진의 핵심 기능이라 할 수 있겠다.   이 외에도 BufferConstruction 객체를 이용하여 견고하고 효율적인 지오메트리 버퍼(Buffer)와 같은 작업을 수행할 수 있다. 또한 버퍼링, 좌표변환과 같은 일반적이고 유용한 지오메트리 관련 작업을 수행할 수 있으며 GeometryServer web service를 이용하면 인터넷 상에서 이러한 실행이 가능하다.   지오메트리를 정확하게, 일관성있게, 예측가능하게 사용하기 위해서는 지오메트리와 공간좌표체계에 대한 정확한 이해가 필요하다. ▣ Introduction to geometry objects Points, Multipoints, Polylines, Polygons, and MultiPatches과 같은 최상위 수준의 지오메트리 객체 외에, Paths, Rings, Segments, TriangleStrips, TriangleFans, Triangles은 Polyline, Polygon, MultiPatch를 생성하기 위한 빌딩 블록의 역할을 한다...

[Tips]ArcSDE Shape Verification Rules

이미지
아래 문서는 ArcSDE Developer Help의 Shape Verification Rules 을 정리한 문서입니다. 이 문서에는 Point, MultiPoint, Polyline, Polygon 등의 Topology 일관성에 관한 검증 규칙(Verification Rules)이 어떻게 적용되어야 하는지를 설명하고 있습니다. ArcObjects Geometry API 중 ITopologicalOperator 인터페이스와도 관련이 있으니 함께 참조하시기 바랍니다. ▣ The verification rules for point shapes     * 포인트의 면적과 길이는 0.0으로 설정     * 단일 포인트의 Envelope은 포인트의 X, Y값으로 설정     * Multipart 포인트 shape의 envelope은 minimum bounding box로 설정     * Sample Code - MultiPoint 코드보기.. [code c#] //MultiPoint System.Object missingObj = System.Type.Missing; IPoint partPoint = null; IPointCollection multiPoints = new MultipointClass(); IMultipoint multiPoint = (IMultipoint)multiPoints; partPoint = new PointClass(); partPoint.PutCoords(0, 0); multiPoints.AddPoint(partPoint, ref missingObj, ref missingObj); partPoint = new PointClass(); partPoint.PutCoords(0, 0); multiPoints.AddPoint(partPoint, ref missingObj, ref missingObj); partPoint = new PointClass(); pa...