I am very much a novice with Arcade Expressions and I was hoping someone may be kind enough to help with writing an expression that can calculate the number of miles in a layer ('DART_Bus_Route_KML') do not fall within a 0.25 mile radius of locations on another layer ('billboards').
I thought I'd try to use the technology that everyone raves about, ChatGPT, to help with writing the expression, and it wrote this:
var bus_miles = Length(geometry(DART_Bus_Route_KML))/1609.34;
var near_billboards = Intersects(geometry(DART_Bus_Route_KML), Buffer(geometry(billboards), 0.25));
var non_near_bus_miles = Sum(Filter(bus_miles, !near_billboards));
return non_near_bus_miles;
When running the expression, I get the error message: "Execution error - Line : 1, 32: Identifier not recognised".
Any suggestions on where our AI overlord may have made an error in his expression?
Thanks to anyone who may be able to help!
Solved! Go to Solution.
I asked because Arcade has different profiles, each with different capabilities, so it does matter.
But honestly, unless you need the output of this expression to dynamically adjust to live data, you're probably better off just performing an actual analysis workflow, buffering and clipping the layers.
If you're doing this entirely in AGOL, check out the documentation.
That's pretty funny! And not too bad, considering.
To problems are a few:
Where are you trying to implement this expression? ChatGPT probably doesn't know which Arcade profile you're working in.
Hi Josh! Thanks for the quick reply! I'm probably embarrassing myself here, but I don't think I really know 'where' I'm trying to implement it - or at least I'm not totally understanding the question.
It's in one of my maps on ArcGIS Online (not pro - if that makes a difference). In terms of where the ultimate answer would appear (pop-up, field, etc.), it isn't as important to me as just figuring out the number of miles that don't fall within the 0.25 miles.
Is there a better way of clipping the route without using Arcade?
This will probably be the only time I end up using a feature like this but I may end up just going through the online course because based on your feedback, here is my poor attempt at trying to update the expression (at least based on my interpretation of your first few notes).
var bus_miles = Length(geometry($featureDART_Bus_Route_KML))/1609.34;
var near_billboards = Intersects(geometry($featureDART_Bus_Route_KML), Buffer(geometry($layerbillboards), 0.25));
var non_near_bus_miles = Sum(Filter(bus_miles, !near_billboards));
return non_near_bus_miles;
I asked because Arcade has different profiles, each with different capabilities, so it does matter.
But honestly, unless you need the output of this expression to dynamically adjust to live data, you're probably better off just performing an actual analysis workflow, buffering and clipping the layers.
If you're doing this entirely in AGOL, check out the documentation.
That is great feedback Josh! I will definitely dive in on the documentation.
Really appreciate you going out of your way to help!
Great idea using ChatGPT! I just tried it for some labeling help and it sort of worked, but it definitely was better than google : )