Hello,
I have a Field Maps project that is requiring some Arcade writing. Our fielders want the name of a line to be auto-populated. We are working in utilities. The fielders are going down a street, adding a pole/point feature, naming it, move on - next pole/point feature, naming it - then draw a polyline/span connecting the two. The ask is that the polyline/span will auto-populate the Span to be "name of pole - name of pole". Example: first pole is 12345, second pole is pole number 12346, so the span will be 12345-12346.
I'm aware of Intersect, I have used that before to populate data from a singular entity onto another intersecting entity. I've hit a mental block with this question because these are two points being used to intersect one line.
I attached a screenshot as an example.
Any help would be greatly appreciated.
Solved! Go to Solution.
using Attribute Rules you could do something along the lines of this:
var pole = FeatureSetbyName($datastore,"points",["Name"])
var line = buffer($feature,.1)
var ab = Intersects(pole, line)
var line_name = ''
for (var a in ab){
var pole_name = DomainName(a, "Name")
line_name += pole_name +'-'}
return left(line_name, count(line_name)-1);
You could also calculate the values after the fact, if you are not able to use attribute rules (e.x. using ArcGIS Online Hosted Feature Layers)
The is what it looks like labeling the created features in ArcGIS Pro
using Attribute Rules you could do something along the lines of this:
var pole = FeatureSetbyName($datastore,"points",["Name"])
var line = buffer($feature,.1)
var ab = Intersects(pole, line)
var line_name = ''
for (var a in ab){
var pole_name = DomainName(a, "Name")
line_name += pole_name +'-'}
return left(line_name, count(line_name)-1);
You could also calculate the values after the fact, if you are not able to use attribute rules (e.x. using ArcGIS Online Hosted Feature Layers)
The is what it looks like labeling the created features in ArcGIS Pro
Thank you for taking the time to look at my question. I am using AGOL hosted feature layers. I will need to run this on the backend. I will save that code for future use. Thank you!!
Trying not to use attribute rule for online-live layers. Can either of you elaborate how to get this code to work with calculation on an layer in AGOL? I tried both in Pro as field calculate and AGOL calculate. Keep getting error on line1 not finding the layer.. @MarkBockenhauer @KWilliams
Because I was using an AGOL hosted feature layer, I was not able to use to the code provided by Mark to set up the calculation to happen during field collection. Instead I came up with my own solution in ArcPro when post-processing the data. I also did not set up the attribute rules as suggested because this was a one time process. What I did do, I hope its not too wordy:
I hope that helps!
Thanks @KWilliams I will end up using this method like I have similarly before if I can't get an arcade expression to work.