I'm totally new to stackexchange and i'm in this beautiful informative place for one problem. I'm a .net programmer and i need to write a program that reads a shapefile and performs routing operation. I'm looking for an open source solution. Is there any idea?

  • Does the shapefile already have from-nodes and to-nodes assigned to it? Aug 4, 2011 at 15:35
  • unfortunately not. Is it possible to make it in ArcGIS? Aug 5, 2011 at 13:46
  • Are the ends of the polylines snapped to each other? If so you could calculate FNODEID and TNODEID fields based on concatenation of x and y of the polyline's from point and to point respectively. You should also consider an ID for the polyline itself, since the FID could change as a result of editing. Once you have the necessary IDs, you can handle it as a graph theory problem. See resources. Aug 5, 2011 at 14:17
  • yes. How to create these fields in ArcGIs or any other software? Does it need programming? Could u explain more, Plz? Aug 5, 2011 at 18:52

3 Answers 3


I would start by looking at this implementation in C# along with the DotSpatial libraries maybe?

  • It sounds i have to make graphs out of shapefile myself. Am i right? I was looking for a more direct way, not to handle this dirty things. Aug 5, 2011 at 13:55

Small advice: use A* algorithm instead of Dijkstra, with a decent heuristic you'll get much better performance.


  • You are extremely right :) Aug 5, 2011 at 6:26
  • Thanks. but is there any implementation for that in .net using shapefile? Aug 5, 2011 at 13:52
  • You should treat reading shapefiles and A* algorithm routing as two separate things. A* is usually implemented in a generic way so it can be reused for different purposes. As for reading shapefiles, take a look at SharpMap.
    – Igor Brejc
    Aug 5, 2011 at 14:16

If the open source requirement isn't too strict (you already seem to accept Arcgis as part of the solution), you can also look at our RW Net solution (www.routeware.dk). It is a .NET component, which will import SHP files and let you do routing calculations. No need for adding fnode/tnode fields, since the component handles that internally.

  • Thanks a lot. Yes, i have arcgis but i can't pay anymore. It Sounds Route Net 2.43 free version performs the job. Also i found TF.Net useful i.e reading shapefile and calculates shortest path, as described in documentation Aug 6, 2011 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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