Skip to content

lucasfrancaid/distance-calculation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn


Logo

Distance Calculation

Calculate the distance between two addresses!
https://distance-calculation.netlify.com/

Table of contents

About the project

Logo Distance Calculation

This project was created to calculate the distance between two addresses, and return the view of the distance, travel time and the origin and destination markers(pin) on the map.

API's used

It is important to note that when thinking about some new features, I was able to do a search in which I can use the Directions API to return distance, duration, latitude and longitude, in addition to the polylines, which allow me to define in addition to the markers, the way to be traveled between origin and destination. (But it is for a next project...)

Built With

Using the DistanceCalculationAPI

It is possible to consume the DistanceCalculation API for this project by sending as parameters:

  • origins (source address)
  • destinations (destination address)
  • mode (walking, driving or bicycling)

Make a request (POST) in https://distance-calculation.herokuapp.com/distance

Example:

{
	"origins": "São Paulo, SP",
	"destinations": "Rio de Janeiro, RJ",
	"mode": "driving"
}

The return will come with the following properties:

{
  "distance": "434 km",
  "duration": "5 hours 34 mins",
  "origins": {
    "lat": -23.5505199,
    "lng": -46.63330939999999
  },
  "destinations": {
    "lat": -22.9068467,
    "lng": -43.1728965
  },
  "zoom": 8,
  "center": {
    "lat": -23.2286833,
    "lng": -44.90310294999999
  }
}

License

Distributed under the MIT License.

Contact

Lucas França - https://lucasfrancaid.com.br/