Copying an attribute from multiple point feature classes to one line feature class using attribute rules.

535
2
Jump to solution
05-27-2022 10:13 AM
TravysBaker
New Contributor II

Hello all,

After using this excellent video on copying attributes to lines  ( https://www.youtube.com/watch?v=ueckrlhto0Q ) I've automated a large portion of my companies utility asset id process within the map, which is great. I started running to problems with adding multiple point feature classes into this code in order to account for pipes (such as pressurized mains) that could have their start node at either a manhole or a pump, or in a water system the main could start/end at a fitting, a valve, a hydrant, or any other number of features. 

In order to account for this I tried to add multiple variables to the original code so I can check different feature classes but that didn't work for me as it seems like Arcade doesn't appreciate having multiple feature geometries in one rule. Any help on this would be great!

Heres upper manhole code: 

 

var g = Geometry($feature);

var fromManholeGeometry = g.paths[0][0];

var Manhole = FeatureSetByName($datastore, "ssManhole", ["facilityid"], false);

var fromManhole = First(Intersects(Manhole, fromManholeGeometry) )

if (fromManhole == null) return "No UPMH";

return fromManhole.facilityid;

 

 

Downstream manhole 

 

var g = Geometry($feature);
//the '-1' grabs the last segment and last vertex of a line. 
var toManholeGeometry = g.paths[-1][-1];

var Manhole = FeatureSetByName($datastore, "ssManhole", ["facilityid"], false);

var toManhole = First(Intersects(Manhole, toManholeGeometry )  )

if (toManhole == null) return "No DNMH";

return toManhole.facilityid;

 

 

And again, any help would be much appreciated! 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Something like this?

var g = Geometry($feature)
var fromPoint= g.paths[0][0]

// test manholes
var Manhole = FeatureSetByName($datastore, "ssManhole", ["facilityid"], false)
var fromManhole = First(Intersects(Manhole, fromPoint))
if(fromManHole != null) { return fromManhole.facilityid }

// test pumps
var Pumps = FeatureSetByName(...)
var fromPump = First(Intersects(Pumps, fromPoint))
if(fromPump != null) { return fromPump.facilityid }

// test fitting
//...

// default return value
return "no intersecting points found"

Have a great day!
Johannes

View solution in original post

2 Replies
JohannesLindner
MVP Frequent Contributor

Something like this?

var g = Geometry($feature)
var fromPoint= g.paths[0][0]

// test manholes
var Manhole = FeatureSetByName($datastore, "ssManhole", ["facilityid"], false)
var fromManhole = First(Intersects(Manhole, fromPoint))
if(fromManHole != null) { return fromManhole.facilityid }

// test pumps
var Pumps = FeatureSetByName(...)
var fromPump = First(Intersects(Pumps, fromPoint))
if(fromPump != null) { return fromPump.facilityid }

// test fitting
//...

// default return value
return "no intersecting points found"

Have a great day!
Johannes
TravysBaker
New Contributor II

Thats great, thank you so much!

0 Kudos