Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm very new to the world of GIS, but I'm learning a great deal from this site, as well as others. I fell like this should be 'easy' but I need to be pointed in the right direction. I'm trying to map a railcar's route based on a shapefile of the railroad lines in America.

What I have:

1) I have a file containing specific railcar's routing. Railcars have Radio Frequency ID tags (RFID) that are scanned when entering a rail yard. This file contains all these scanned entry points as well as Lat/Log data for the yard.

2) I have a shapefile of all railroads in America.

My Problem:

I want the path of the railcar to follow the railroad shapefile exactly. If I just tried to map the Railcar file, it would show direct lines from one yard to another, and would not follow the actual path of the railroad. How do I do this? Again, I'm just looking to be pointed in the right direction.

share|improve this question

What you want is network analysis. You can access the GRASS network analysis tools through Quantum GIS. What it does is allow you to calculate and model travel and cost of travel (time, distance, money, etc.) restricted along paths called edges. In your case, the railways would be the edges. If you have access to ArcGIS with Network Analyst, the tools are a bit easier to use, but you can get everything you need done with GRASS GIS.

Edit: Here is a link to a paper about network analysis in GIS.

share|improve this answer
Thanks! It seems like this is really geared toward analyzing/selecting best travel patterns. I (think) what I'm trying to do should be easier. I just want plot a single railcar trip, but make sure the railcar path follows the railroad shapefile. Is there an easier option? – Josh Mar 27 '13 at 16:40
You could also try the QGIS road graph plugin if all you want to do is visualize the trip. This also uses network analysis, but is much simpler to use and only gives you a route. Effectively, it would calculate your railcar's shortest trip from point A to point B a la Google Maps or Mapquest. – Jay Guarneri Mar 27 '13 at 16:43
The problem with google maps or mapquest - They don't do railroad routes. I'm guessing this is the same problem with the road graph plugin. My end goal would be plot the exact path a railcar takes, and then calcuate the miles (based on lat/long of each point passed). – Josh Mar 27 '13 at 16:47
The road graph plugin will use whatever line file you feed it. In this case, you just need to tell it to use your railroads. It isn't actually using Google Maps or Mapquest, it will just calculate your route along the supplied railroads in the same way that these services calculate your directions along highways. The most likely hitch is going to be connectivity problems: if there are any erroneous gaps in your railroads, you might get some funny results. If you think you have that problem, look into Topology editing, (GRASS has some good tools for this). – Jay Guarneri Mar 27 '13 at 16:50
great. That sounds like it may work. But if not I can search each segment at a time, like you said. But it may take me forever. – Josh Mar 27 '13 at 19:09

If you have the gis of rail lines you already have the length of the path of travel. You can just find the length in miles of the vector segments in question from beginning point ot end point. The data is already present. As far as routes from reader at yard Y to reader at yard X routing is done depending on the contract as presented by contract on the waybill which determines which carriers and routes loads and empties are to follow. Another words, routes for the same origin and desitnation can change. So the problem becomes what is the definition you want for your application, distance between yards along rail route or length per individual car route(s)?

share|improve this answer
Right, but the car location messages (CLMs) of a specific railcar should give a good reference as to how the car will travel. There is not many times there would be multiple paths between yard Y and yard X on the same carrier. You will always receive a CLM before a car interchanges to another carrier, so not worried about interchanges either. And actually my routing i'm studing is UP direct, so no other carriers are required. – Josh Mar 27 '13 at 19:04
The variances in the routing is actually why I’m wanting to do this. Railroads calculate mileage for Fuel Sur Charge based on a predefined route (usually generated by PC* Miler) but if the actual routing is less on some cars? Then we should pay less FSC. – Josh Mar 27 '13 at 19:06
It depends if your data analysis is more accurate than the carriers than pc miler, whether other carriers accept your calculations, and what methods pc miler uses to generate it's results compared with what you may develop. – lewis Apr 3 '13 at 15:51

You could try my routing script for QGIS Processing based on the core network analysis library. It expects a point layer and a network layer as input and returns a route between the points.:

enter image description here

enter image description here

share|improve this answer

Your Answer


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.