# Pull data from sewer line feature to manhole point feature

341
4
07-30-2021 07:37 AM
Labels (1)
New Contributor II

I'm probably in the wrong group but I found something similar to my problem here:

Update Attribute of Intersecting from Point of Var... - Esri Community

I need to calculate the rough depth of a manhole. I can do this by pulling the upstream elevation of an attached pipe and subtracting it from the rim elevation of the manhole.

I have this example that pulls data from a point feature to a line feature and it works for me:

var g = Geometry(\$feature);
var fromPointGeometry = g.paths[0][0];
var fsPoint =FeatureSetByName(\$datastore, "ssInlet", ["FACILITYID"], false);
var fromPoint = First(Intersects(fsPoint, fromPointGeometry ) )
if (fromPoint == null) return
return fromPoint.FACILITYID;

So I tried this just to pull in a value which I can later subtract from the rim elevation.

var g = Geometry(\$feature);
var fromPointGeometry = g.paths[0][0];
var fsPoint =FeatureSetByName(\$datastore, "ssGravityMain", ["UPELEV"], false);
var fromPoint = First(Intersects(fsPoint, fromPointGeometry ) )
if (fromPoint == null) return
return fromPoint.UPELEV;

but it throws an error:

I'm not very familiar with Arcade, could someone point out what I need to make this work?

1 Solution

Accepted Solutions
MVP Regular Contributor

The error is in this line:

``var fromPointGeometry = g.paths[0][0];``

What this does is take the first point of the first segment of a line feature. It works in the first expression, because you run it on a line feature. It doesn't work in the second expression, because you run it on a point feature and those don't have the path variable.

This should work:

``````var g = Geometry(\$feature)
var fsLine = FeatureSetByName(\$datastore, "ssGravityMain", ["UPELEV"], true)
var fromLine = First(Intersects(fsLine , g))
if (fromLine == null) { return }
return \$feature.RIMELEV - fromLine.UPELEV``````

Have a great day!
Johannes
4 Replies
MVP Regular Contributor

The error is in this line:

``var fromPointGeometry = g.paths[0][0];``

What this does is take the first point of the first segment of a line feature. It works in the first expression, because you run it on a line feature. It doesn't work in the second expression, because you run it on a point feature and those don't have the path variable.

This should work:

``````var g = Geometry(\$feature)
var fsLine = FeatureSetByName(\$datastore, "ssGravityMain", ["UPELEV"], true)
var fromLine = First(Intersects(fsLine , g))
if (fromLine == null) { return }
return \$feature.RIMELEV - fromLine.UPELEV``````

Have a great day!
Johannes
New Contributor II

As it works now sometimes it picks the wrong value of UPELEV as there are two or more pipes attached to each MH (Possibly several in and one out).

Is it possible to have the script look at each value of UPELEV for any line features of SSGravityMain that are connected to the MH (there could be 2 or more) and pick the smallest value which is the invert out?

MVP Regular Contributor
``````var g = Geometry(\$feature)
var fsLine = FeatureSetByName(\$datastore, "ssGravityMain", ["UPELEV"], true)
var fromLines = Intersects(fsLine , g)
if (fromLines == null || Count(fromLines) == 0) { return }
return \$feature.RIMELEV - Min(fromLines, "UPELEV")``````

Have a great day!
Johannes
New Contributor II

That's great and will certainly come in handy!