Creating a buffer for something that is between 250 and 500 feet using arcade.

393
1
07-14-2020 11:00 AM
BenWan
by
New Contributor III

Hi,

I am trying to display intersecting data from two layers that is in between 250 and 500 feet using the Buffer expression in arcade in pop-ups. I have been trying to search this up but not having any luck.

This is what I'm doing:

Buffer($feature, INBETWEEN 250 AND 500, 'feet')

The bold syntax is what I am struggling with. Any help appreciated!

Thanks

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Ben Wan ,

What you need is to calculate two buffers and determine the symmetric difference between those polygons and test against that polygon. In the example below you would continue using the function "Intersects" using the variable "pol":

var buf1 = Buffer($feature, 250, "feet");
var buf2 = Buffer($feature, 500, "feet");
var pol = SymmetricDifference(buf1, buf2);

An example to show how this works: 

// create a dummy point at 0, 0
var pointJSON1 = { "x": 0.0, "y": 0.0, "spatialReference": { "wkid": 3857}};
var pnt1 = Point(pointJSON1);

// create two buffers around point (for simplicity I use 250 and 500 meters)
var buf1 = Buffer(pnt1, 250, "meter");
var buf2 = Buffer(pnt1, 500, "meter");

// Create the symmetric difference which will contain only the larger outer buffer polygon
var pol = SymmetricDifference(buf1, buf2);

// create a second test point at 0, 350 that will be inside the polygon
var pointJSON2 = { "x": 0.0, "y": 350.0, "spatialReference": { "wkid": 3857}};
var pnt2 = Point(pointJSON2);

// test against the point 0,0 (will not intersect with polygon)
Console("pnt1 intersects: " + Intersects(pol, pnt1));

// test against the piont 0, 350 (will intersect with polygon)
Console("pnt2 intersects: " + Intersects(pol, pnt2));

return "OK";

This will return in the Console:

pnt1 intersects: false
pnt2 intersects: true
0 Kudos