Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a shapefile of U.S. counties. I also have a line segment. I want to compute the distance of each county to the line. I have also divided the line segment into 10 equal segments. I want to know, for each county, which of the 10 segments is closest?

Is there an easy way to do this in GIS? Right now, I just do the distance separately for each border segment, 10 times. Then in Excel, I determine which segment gives the shortest distance. Identifying, for each county, which of the 10 distances is the miniimum, and then which segment gives that minimum.

I know I can streamline this for the distance part had I not subdivided into the 10 segments. I can just get the shortest distance in general using the whole line. However, I don't know what's a fast way to identify which line segment yields it.

I use ArcGIS 10.1 and ArcMap. I would appreciate any help that you can provide!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

To do this I would use a Spatial Join with match option of CLOSEST and a distance_field_name.

"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."

share|improve this answer
    
Should be no need to do anything with Field Mapping. For Join Operation try ONE_TO_ONE first, and see if that provides the solution you seek. –  PolyGeo Oct 15 '12 at 2:18
    
No it's not working. When I type Border as the Distance_field_name, it puts the distance in that cell (which I want), but nowhere does it say which border segment along the line is giving that distance. –  user1690130 Oct 15 '12 at 3:25
    
My quick read of the help suggests that TARGET_FID will hold the identifier of the line segments. –  PolyGeo Oct 15 '12 at 4:11
    
I don't think so. TARGET_FID just creates an identifier for every polygon. Am I inputing things into the Spatial Join incorrectly? Is it Spatial Join under Overlay under Analysis? Should I be specifying something under Field Map? –  user1690130 Oct 15 '12 at 5:21
    
Perhaps there is something unique about my case. It seems that just changing the Name of each segment made the difference. I am probably doing something wrong with the Editor feature. When I split, the default is to assign each segment the same name, but a different numerical ID. I just changed the name, and now I can see the difference when I do the Spatial Join. –  user1690130 Oct 15 '12 at 5:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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