I have two point datasets, one containing multiple transit stops and the other containing multiple schools. I also have a street line dataset.

I need to generate a table that gives me the shortest distance from a school, to a transit stop, but only ALONG THE STREET LINE dataset. I know how to generate a "near table" but that gives me a straight line distance. That's all fine and good, but if I am a student who needs to walk to a transit stop, or drive to a large transit facility, a straight line distance does me no good. I need to be able to walk/drive along a street to reach my destination.

Keep in mind that I need to incorporate two different point files. A lot of the solutions only include one point file, just finding the distance between two of the points in the single data set. I need to use 2. The actual route for which the distance was calculated would be great too.

I am using ArcGIS 10.2 and have the Network Analyst Extension.

  • 2
    This may not be what you want to hear, but this does indeed sound like a Network Analysis problem, specifically a Closest Facility Analysis problem. You would of course then need to build a network dataset and go through all those steps. Otherwise you could do it in Python. The network analysis method might be worth it if you are using your street dataset for other analysis as well. Commented Apr 16, 2015 at 17:32
  • I am running ArcGIS 10.2 and I have most of the extensions, including Network Analyst. I've used it a couple times but am not a pro at it. I'm thinking of doing the Arc Tutorial on it to get more acquainted with it. I thought there might be a way to generate a near table and add the variable of the street line data, but it doesn't look like that's possible. Commented Apr 16, 2015 at 19:16
  • Somewhere around here there was a question where someone wanted to do this without network analyst and it involved going to raster and using path distances and such. It wasn't pretty. And as you've discovered, Near is just Euclidean distance. While the question seems pretty simple the actual execution is somewhat broad. Give me a second and I'll have an answer with a basic outline and links to help.
    – Chris W
    Commented Apr 16, 2015 at 20:16
  • 1
    @JustinCahoon FYI, a while back I had never used Network Analyst before and had a similar problem, and it only took a couple days to learn enough about it to solve my problem. It's not really as complex as it may appear at first: although you can get very fancy with the analysis once you start including things like travel time, stop signs, different road types, one-ways, etc. If all you need to do is find the distance along your road network between two points it's much simpler.
    – Dan C
    Commented Apr 16, 2015 at 20:30

1 Answer 1


You'll need to use Network Analyst for this. The first thing you will need to do is turn your lines into a network. The Network Analyst Tutorial exercise 1 covers this, but be aware it may not go into sufficient depth, as there are geometry and topology considerations to take into account. Why isn't the service layer shape properly spread out? touches on some of the issues about network connectivity and may help you figure out why things aren't working if you run into issues. Since you're only concerned with distance, and that's an inherent property of the lines that become network edges, you don't have to worry about calculating travel times (length/speed limit) or anything if you don't have those attributes already.

Once you have a network you can run a Closest Facility analysis, as Cindy mentioned in her comment. Exercise 4 of the tutorial covers this, and reviewing the help files will also give good background. Your transit stops will be your incidents and your schools your facilities. The solver can take two separate point files for these in a case like yours, or the same file for both (all schools to other schools). It will then generate a route from every transit stop to the nearest school. You can also set it to go to the nearest two or more schools if you like, say if you wanted to compare just how much farther away it would be.

If you were looking at distances from a transit stop to all schools, or from every one point to every other point, you might consider an OD Cost Matrix solve. See that linked question for distinction between the two, and also the note that it can't generate routes. Since you want the routes, Closest Facility is the way to go.

Note that the results are not written to a file by default, so if you want all those routes as a feature class/shapefile you'll need to export them (simple as right-clicking the layer) once you've run the solver.

We have several questions on Closest Facility and other Network Analyst related issues, so if you run into specific problems you may find the answer here already, or you can ask a new, specifically focused question on the issue.

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.