The shortest path and the fastest path between two location by using QGIS

SUKANYA
4 min readJul 5, 2020

--

The beginning of every journey will always start with automatic questions in our mind such as

  • Which route to go?
  • Which method will go the fastest?

Distances and Time is the Key!

I got this idea already some time ago and also published online a few of tutorial, but just now thought that it might write a short blog on how to do this. For some, this might also serve as a more general introduction to the awesome QGIS with the aid of Open Route Services (ORS Tools) plugin or the Geoscientist.

How to calculate the shortest path and the fastest path between two location by using QGIS?

ORS Tools provides access to most of the functions of openrouteservice.org, based on OpenStreetMap. The tool set includes routing, isochrones and matrix calculations, either interactive in the map canvas or from point files within the processing framework. Extensive attributes are set for output files, incl. duration, length and start/end locations.

1. Require one additional plugin which is called ORS tools.

1.1 Download additional plugin by go to plugins > manage and install plugins

1.2 They will display all plugins > search ORS tools > click ORS tools > install plugin (This process is installing plugin which is ORS Tools)

2. Add OpenStreetMap as a base layer

Go to Web > QuickMapService > OSM > OSM Standard

3. Calculation the shortest distance

3.1 Go to Web > ORS tools > ORS tools.

3.2 It has to sign up and get a special API key from openroutservice.org t o order to get the result. There are simply sign up .

3.3 When click sign up, it opens the web page of openrouteservice.org and form here simply just enter your username and the requested information in order to first register. To activate your account please confirm on your E-mail.

3.4 In this dashboard you can simply select request a token and request for a free token and as the name you can create a name. Click create token.

There will eventually generate the API keys. Then click create token.

3.5 You can copy your API keys and paste in ORS tool window by go to ORS tool window > setting provider. In provider settings window, you can paste your API key and Base URL. After that you can click OK.

4. Before select starting point, in ORS Tool window you going to go with and select option. In this case, I go with driving car and fastest option. Then add waypoints as green icon. It can simply select this add where points interactively from the map canvas button the plus sign.

5. Specify starting point. You can click on the starting point which you would like.

In this case choose started from Siam Paragon . My second point is Kasetsart University. My ending point is IMPACT Arena, Muang Thong Thani.

When you want to finish your network, you can actually instead your network by double clicking. It will open ORS tool window. You can check your point and click apply.

6. It will generate the route for you over here you can see that have a new layer. After that go to properties of route layer. It will open layer property window. You can change the symbology ( click simple line). Now you can see the route which you are supposed to take if you were to travel from that particular point in Bangkok (Siam paragon) to Nonthaburi (IMPACT Arena) that through Kasetsart University which you want to stop.

7. Next, open up the attributes table of this and what are they sort of information in 2 types. You have the distance in kilometers and duration in hours.

This process is one of the ways that you can calculate fastest distance that you can actually use in order to get from point A up to point B through number of points as many as you want. This ORS tools actually can calculate the fastest distance or the shortest distance depending on your preference.

--

--