Help with Arcade expression

05-13-2020 01:03 PM
New Contributor

When using an Intersects on a Buffer in Arcade I appear to be getting inaccurate results. I tested an intersection of two lines, one with a buffer of 30 feet. However, the result is null unless the lines are within 9 feet of each other? Here is the expression I am using:

var fsRoadsAll = Intersects(Buffer($feature, 30, 'feet'), FeatureSetByName($datastore, "ROADS_ALL", ["SPEED"]));
var intersect_max = null;
var cnt = Count(fsRoadsAll);
if (cnt > 0) {
intersect_max = 99
if (intersect_max == null) return null;
else return intersect_max;

Any idea what I maybe doing wrong?

0 Kudos
2 Replies
Esri Esteemed Contributor


I believe you are running into a limitation of Arcade as described here:Geometry Functions | ArcGIS for Developers 

...note that geometries fetched from feature services, especially polylines and polygons, are generalized according to the view's scale resolution. Be aware that using a feature's geometry (i.e. $feature) as input to any geometry function will yield results only as precise as the view scale. Therefore, results returned from geometry operations in the visualization and labeling profiles may be different at each scale level. Use these functions at your discretion within these contexts.

If you zoom really close to the feature, do you still get the same erroneous result?

0 Kudos
New Contributor

Hi Xander,

I seem to get the error regardless of the zoom scale. I did some more testing, and noticed that if the buffer distance is reduced to 10, then it returns null unless the lines are within 3 feet. I then increased the buffer to 90 and it required a line to be within 27 feet to not return a null. So there appears to be a direct ratio to the problem. In the meantime I have increased the buffer distance to 100 feet, which is giving me the desired results of a 30 foot buffer. This isn't optimal, but is working for now.