When I use Spatial Join, the distance attribute is not being added to the resulting shapefile.

I'm trying to use Spatial Join to assign each of 16,151 points to one of three zones (see screenshot), and also assign a distance field so I can include points that fall outside the zones (in this case there is only one, but I will be doing this with many other point shapefiles).

Points and zones

I'm doing a JOIN_ONE_TO_ONE operation, with the CLOSEST match option, a Distance Field Name called DistZone, and a search radius of 2 km.

The tool successfully adds a Zone attribute but no DistZone attribute.

The point shapefile has a lot of attributes (80), but I read that the max is 255, so that should not be the problem. All inputs are in the same coordinate system.

This was working successfully for me yesterday, and now it has stopped working. Any idea why the distance field is no longer being added?

UPDATE: I've answered my own question. Since the shapefile has so many attributes, I didn't realize that the DistZone field was being added all the way on the left, while the Zone field is added all the way on the right.

  • 2
    Welcome to GIS SE. As a new user, please be sure to take the Tour. Please edit your question to specify: The GIS software are you using, the database product (with version), the exact syntax of your usage. A screenshot would not be inappropriate. Please help us to be able to help you.
    – Vince
    Commented Oct 28, 2015 at 17:24
  • 1
    Assuming you're talking ArcGIS, you might want to look at the help file (last box before the code samples). The distance field is only added in a very specific circumstance.
    – Chris W
    Commented Oct 28, 2015 at 18:09

1 Answer 1


If you want the distance field to be added to the output feature class using Spatial Join, you need to specify the optional distance_field_name. Otherwise, the distance field will not be added.

distance_field_name (Optional) The name of a field to be added to the output feature class, which contains the distance between the target feature and the closest join feature. This option is only valid when the spatial relationship (Match Option) CLOSEST is specified. The value of this field is -1 if no feature is matched within a search radius. If no field name is specified, the field will not be added to the output feature class.

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