Search code examples
pythondistance-matrix

I want make distance matrix using google api


I am trying to use the Google API using Python. The distance matrix I'm going to make looks like this:

Figure 1

I want to find the navigation from A to B, C, D, E It's not an Euclidean distance. The data I have is the address and coordinates (latitude and longitude) of each point.

I want to tabulate the distance and time as shown in the figure, as if I did directions on Google Maps (https://www.google.com/maps).

I don't even dare to start yet. What data should I refer to or search for?

Thank you


Solution

  • if I getting it right you want to create a first dataset of points' coordinates in order to then calculate the distances between them and the time needed for the trips.

    I suggest you to create something like the following:

    enter image description here

    Please, notice that the coordinates are in GPS format. You that have to manage them as a geodataframe in order to calculate distances and times.