2

I am using ArcMap 10.2.

I have two layers- one is around 2,000 geolocated ballot boxes while the other is around a dozen geolocated facilities. I would like to calculate the total distance between each ballot box and all dozen or so facilities. For instance, Ballot Box 1 is 10km from Facility X, 15km from Facility Y, and 20km from Facility Z, and so on. So Ballot Box 1 would be assigned a score of 45km. I'd like to calculate this score for all 2000 or so ballot boxes.

So far, I've used the point distance tool where the ballot boxes are the input features and the facilities are the near features, left the search radius blank, and ArcGIS produces a table, with a "DISTANCE" column populated, so it seems to have worked. My question is threefold:

  1. Is this the correct procedure?
  2. In what unit is this distance reported (Projections are UTM, so I assume it defaults to meters?)
  3. If I leave the "search radius" blank, does ArcGIS default to figure the distances in the layer's full extent?
1

This is a correct procedure. You can then use summarize table to get the sum of distance based on the ID's of your Ballot Boxes, and join this table.

The point distance indeed provides distances based on the coordinate system, so in your case it will be meters, and if you don't specify a distance it will work on the full extent.

As a remark, if you have a very large (e.g. 100000) number of ballot boxes ad only a few Facilites, you can create a set of raster with euclidian distance, sum them and then extract values to points. This will be less precise (due to raster reslution), but faster.

1

Create numeric field (double) in the table of ballots and try this with field calculator. Code block:

def TotalDist(shp ):
  p=shp.firstPoint
  mxd = arcpy.mapping.MapDocument("CURRENT")
  layers=arcpy.mapping.ListLayers(mxd, "facilities")
  lr=layers[0]
  g=arcpy.Geometry()
  geometryList=arcpy.CopyFeatures_management(lr,g)
  s=0
  for f in geometryList:
    s+=f.distanceTo(p)
  return s

TotalDist( !Shape!)

This is old school Avenue approach, My protest against annoying ArcGIS license limitations :) It is good idea to have only 2 layers in table of contentt and hide TOC. Will work much faster

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.