Using Arcade scripting in a webmap to buffer points

161
1
3 weeks ago
Labels (1)
JasonBaker
New Contributor

I am trying to learn if we can use arcade scripting to create buffers around points in a featurelayer in agol. I know this is possible using javascript but would like to use arcade snippets if possible. Anyone try to do this?

Code like this seems reasonable and I have tried to use it with popups but nothing gets updates on a map. I must be misunderstanding something here. Any thoughts?

var PtsLayer = FeatureSetByName($map, "Employees_Location_Pts")

var bufferedStations = Buffer(PtsLayer, 100, 'meters');

bufferedStations
Error: "Test execution error: Execution error - Invalid parameter. Verify test data."
0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

If you read the Arcade docs, there are different "profiles", or contexts in which Arcade is used. Popups and Data Expressions have access to a wide range of functions and capabilities, but symbology is much more limited, for example.

What you're describing, though, is not going to be possible. The buffer function runs against a single geometry, not an entire layer, which I expect is the root of your error message. But even then, the buffered feature is not rendered on the map, it's just held in memory for further use in the expression, like spatial overlays, etc.

If you want a buffer around your points to render accurately and stay linked to the points layer, you can use a Hosted Map Image Layer.

- Josh Carlson
Kendall County GIS