Skip to content

Instantly share code, notes, and snippets.

@asim
Created January 13, 2021 14:18
Show Gist options
  • Save asim/594012aa917f419d95c3ef1880a43b04 to your computer and use it in GitHub Desktop.
Save asim/594012aa917f419d95c3ef1880a43b04 to your computer and use it in GitHub Desktop.

Point to point route ETAs

ETAs Service

This is the ETAs service. It provides ETAs for single-pickup, multi-dropoff routes. It takes into account time and traffic.

Current limitations: • Only supports "Driving" (not walking, cycling) • Does not optimize route

Usage

The ETA service depends on the Google Maps API. Ensure you set the "google.maps.apikey" config value to your API key.

micro config set google.maps.apikey YOUR_API_KEY

Once set, run the service using micro run github.com/micro/services/etas.

$ micro call etas ETAs.Calculate $(cat example-req.json)
{
	"points": {
		"brentwood-station": {
			"estimated_arrival_time": "2020-12-15T11:01:29.429947Z",
			"estimated_departure_time": "2020-12-15T11:01:29.429947Z"
		},
		"nandos": {
			"estimated_arrival_time": "2020-12-15T10:54:38.429947Z",
			"estimated_departure_time": "2020-12-15T10:54:38.429947Z"
		},
		"shenfield-station": {
			"estimated_arrival_time": "2020-12-15T10:48:34.429947Z",
			"estimated_departure_time": "2020-12-15T10:48:34.429947Z"
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment