I am trying to create a polyline copy of a feature when it gets created in a polygon feature class.
The best way I see to do this is a feature to polyline tool inside of model builder, or running a model on a nightly process. It would be cool if we could get the polyline to generate with all the attributes from the polygon upon feature insertion by calling a model in attribute rules.
All of this is happening inside of an Enterprise GDB on SQL.
You can convert the rings of a polygon to a path of a line, just pop the last coordinate that closes the polygon. Use that json to construct a new polyline and return in an attribute rule.
Here is a sample you can test in the playground:
var p = Polygon({
rings: [
[
[-97.06138,32.837],
[-97.06133,32.836],
[-97.06124,32.834],
[-97.06127,32.832],
[-97.06138,32.837]
]
],
spatialReference: { wkid: 3857 }
});
// Sample is only a single part polygon, can loop for multipart
var p_path = Dictionary(p)['rings'][0]
// remove last coordinate
Erase(p_path, -1)
var l = Polyline({
paths: p_path,
spatialReference: { wkid: 3857 }
});
return l