Arcade-Difference between Buffer Distance and Actual Route Distance

869
1
Jump to solution
05-21-2020 03:12 PM
MRReddy
Occasional Contributor

I used the similar code in arcade to find the nearest address point(Using Arcade to Find the Nearest Address Point )

My question is does the distance calculated by buffer and route service are same or almost same

or is it possible to find nearest distance  from $feature to address

var searchDist = 200;
var addresses = Intersects(FeatureSetById($map, "Primary_Address_3482"), Buffer( $feature, searchDist, "feet"));
var cnt = Count(addresses)
Console("Total Number of addresses within buffer: " + cnt);
var nearestaddress;
var min_dist = 250;
for (var f in addresses){
 var addressDist = Round(Distance(f, $feature, "feet"),2);
 if (addressDist < min_dist) {
     nearestaddress = f.FULL_ADDR;
     min_dist = addressDist;
 }
 Console(f.FULL_ADDR + ": " + " " + addressDist);
}

return nearestaddress;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Xander Bakker

Thanks

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi MR Reddy ,

There are a couple of things to keep in mind:

  • When working with a geometry in Arcade derived from $feature the precision depends on the view scale. When you are zoomed out your geometry will be generalized (this will be more the case with lines and polygons).
  • Using the Distance or DistanceGeodetic functions in arcade will return the distance in a straight line which will normally be less than when you determine the distance using routing.
  • Currently you cannot invoke a service (for instance a routing service) te determine the distance based on routing. However, this is something that might be introduced later on.
  • When you look for addresses within a distance of 200 feet, I assume the distance resulted from routing will not be very larger than the one returned from a straight line in many situations.

View solution in original post

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi MR Reddy ,

There are a couple of things to keep in mind:

  • When working with a geometry in Arcade derived from $feature the precision depends on the view scale. When you are zoomed out your geometry will be generalized (this will be more the case with lines and polygons).
  • Using the Distance or DistanceGeodetic functions in arcade will return the distance in a straight line which will normally be less than when you determine the distance using routing.
  • Currently you cannot invoke a service (for instance a routing service) te determine the distance based on routing. However, this is something that might be introduced later on.
  • When you look for addresses within a distance of 200 feet, I assume the distance resulted from routing will not be very larger than the one returned from a straight line in many situations.
0 Kudos