I have a sidewalk_inspection points table and a sidewalk lines table. I want to do a spatial join between the points and the lines so that I can assign the ID of the nearest sidewalk to the sidewalk_inspections.

However, it's occurred to me that I don't know how the spatial join works under the hood.

Does it:

A. Join the points to the nearest vertex in the lines?
B. Join the points to the nearest segment within a line?
C. Join the points to the nearest centroid of a line (or centroid along a line)?

1 Answer 1


Spatial join works by using the shape field of the feature to determine if the features' geometry coincides. The shape field does not limit the geometry to the vertices or centroids, but rather the coordinates of all points associated with the object. Vertices, centroids (area within) and segments are all included in the shape. It joins the points to the nearest line geometry if you specify the Within a Distance Match Option and specify the buffer distance using the Search Radius input field.

If you would like to find the nearest sidewalk to the inspection point I would use the Within a Distance Match Option, and estimate a distance that would be the average distance between sidewalks and inspection points. We have used this method to generate street name combinations for intersections to good effect.

  • 2
    Select 'closest' for the match option and in the 'search radius', specify a distance greater than your max distance between features. 'Within a distance' may not always match the closest feature (it will match with all features that are within the search radius and then use your join rule, which defaults to 'first', so the first feature in the list)
    – jbalk
    Aug 10, 2017 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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