AnsweredAssumed Answered

Is there a way to merge polyline geometries?

Question asked by ibroad on May 12, 2017

Part of the app I'm developing allows our spray crews to mark where they've sprayed by clicking along the electric conductor, which draws a polyline as the click. When they are finished they click a button which buffers the line, and then a screen shows where they enter attributes, which is then added to the FeatureTable. This works, but the lines they draw have the potential to be a bit messy.

 

What I'd really like to do is after the line is buffered, have a spatial query select the conductor that is completely within the buffer, from this selection the geometry is merged into a single polyline. This line is then buffered and added to the FeatureTable. This would make the buffers clean because it would buffer the actual conductor.

 

I had something kind of working, where I was able to select the conductor within the buffer, then based on that selection I iterated through the selected geometry and read the JSON, and recreated the conductor as a single line.

 

The problem is that of course the points aren't in a specific order, so one point could connect to another point far away.

 

I was hoping there would be something in the GeometryEngine, such as

 

var merged = GeometryEngine.merge([list of geometries])

 

Any ideas on how this could be accomplished?

Outcomes