Shortest Path Analysis with Online Routing Mapper Plugin

Bu sayfayı Türkçe olarak okuyabilirsiniz.

Network analysis are widely used in Geoprahic Information Systems. Shortest path, allocation of sources, travelling salesman etc. are grouped in this section. Shortest path analysis is most used one that helps to find a path which is shortest between nodes in a network structure (graph). The “shortest path” could have different aspects. For example shortest path for distance, time or other  criterias.

In GIS applications data is most important part. In network analysis, data come to the fore. When calculating shortest path for one node to another node could be very different depending on data. For instance if your road data have no information about directions (bi-directioanl or unidirectional) than you get incorret output from analysis. And this will be dangerous in case of using it in real life (can cause traffic accident by passing wrong lane)

Today web maps (Google Maps, BingMap, OpenStreetMap, HERE, Yandex.Maps etc.) are not only used for browsing, looking around but also used for finding routes. With these services’s data which cover all around the world, you can calculate routes from one city to another even from one continent to another one. I have developed Open Routing Mapper to be able to use these services in QGIS environment. By using this plugin you can calculate a route in QGIS by pointing start and stop points without having road network data. Also you can get alternative routes by using different services. Results could be transformed to different gis formats like ShapeFile, TAB, Spatialite, DXF etc. in QGIS. The plugins initial version (v0.7) supports Google Direction API, HERE API and YourNavigation API for calculation of routes.

Sample Application

Firstly start QGIS and add a basemap using OpenLayers plugin. Basemap helps us to determine start and stop point in QGIS canvas. In this sample i added OSM Humanitarian basemap.


Than open Online Routing Mapped plugin by clicking the icon. The plugin’s window is shown below. It basically consists of three parts: 1- Service selection, 2-Choosing start and stop points  and 3- Running the analysis.


I calculated the shortest path between İstanbul and Ankara cities as first sample. The plugin’s window for this sample is shown below.

And here is the result.

In this example Google Direction API was used. You can use different services for these start and stop points, just change the Online Service section and click Run button again. By the way you can also compare the results.

The alternative routes calculated by using different services for same start and stop points and the result is shown below. Google Direcion, HERE and YourNavigation API were used this sample.


Sometimes Online Routing Mapper plugin could not generate any result according to choosen online service. The error message is shown below. In this case I suggest you to change online service and try again.

Also accuracy of the results produced using the Google Direction API could be different by distance between start and stop points. For example the route between two city could be coarse on curved turns.


7 comments on “Shortest Path Analysis with Online Routing Mapper Plugin

  1. This is a great program.I am interested in using it to map the optimum route between multiple nodes along a path. Is there anyway to pass the points into your plugin via python and for it to output the best/shortest path from the start/finish but touching all the points?

    • Yes George it it possible to use multiple points for determining an optimum route but not all services supports this feature. I know Google supports this maybe too. I will work on new version of it and i ‘ll add this feature but now i need a rest time. It is open-source if you can dig into code

  2. Nice and easy to use plugin. It would be great to also include some pedestrian routing services, like from

    Best regards,

  3. Hi, thanks for creating the plugin. The TomTom route planner functionality is broken, however. It display the locations of the spoken instructions. What you want is a polyline from the route itself.
    here are 2 code changes you need to make in to `` file:

    line 34:
    self.__tomtomBaseURL__ = ‘’

    and line 208:
    elif self.__serviceType__ == 5: #tomtom JSON
    responseData = json.loads(response[9:-1])
    coors = responseData[‘routes’][0][‘legs’][0][‘points’]
    usefulCoorList = []
    for i in coors:
    usefulCoorList.extend([i[‘longitude’], i[‘latitude’]])
    return self.__coorOrganizer__(usefulCoorList)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s