Hi,
I have a network of triangles (TIN) and when I draw them all on a feature layer I can easily merge them together into one big polygon (or a few polygons) with EditOperation.Merge. Works well and so far so good.
But of course it's a bit silly to draw for example 100000 triangles (which takes ages) and THEN merge them. Instead it would be much better to have the PolygonBuilder create the polygons and then merge them right away and just add one big polygon onto my feature layer. In pseudocode it would look a bit like this:
var editOp = ...;
var polygons = new List<Polygon>(myTriangles.Count);
foreach (var tr in myTriangles) {
var coordinates = tr.GetCoordinates3D();
var pg = PolygonBuilder.CreatePolygon(coordinates, spatialRef);
polygons.Add(pg);
}
editOp.Merge(polygons);
await editOp.ExecuteAsync();
I know this doesn't work right ouf of the box but is there a way I can do this? After all, the merge functionality is there and I don't see why EditOperation.Merge shouldn't work on a sequence of polygons just as it does work on a sequence of Object IDs...
Thanks in advance
Christian
Solved! Go to Solution.
GeometryEngine.Instance.Union should do the same thing: topic8291.html
GeometryEngine.Instance.Union should do the same thing: topic8291.html
That's what I was looking for, thank you! Even though I have to call "SimplifyAsFeature" on each polygon before Union processes them correctly (and I'm dead sure these polygons are simple already).. if I don't simplify them I get an Exception:
System.ArgumentException: Value does not fall within the expected range.
at ArcGIS.Core.Internal.IGeometryEngineIOP.GEUnionArray(IntPtr[] handles, SpatialReferenceTiny srTiny, String wkt, String vWkt, Boolean& outIsKnownSimple)
at ArcGIS.Core.Geometry.GeometryEngine.Union(IEnumerable`1 geometries)