Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GoogleMapPlotter.directions

frslm edited this page Jun 26, 2020 · 10 revisions

GoogleMapPlotter.directions(origin, destination, **kwargs)


Display directions from an origin to a destination.

Requires Directions API.

  • Parameters

    • origin (float, float) – Origin, in latitude/longitude.

    • destination (float, float) – Destination, in latitude/longitude.

  • Optional Parameters

    • travel_mode strTravel mode. Defaults to ‘DRIVING’.

    • waypoints [(float, float)] – Waypoints to pass through.

Usage:

import gmplot
apikey = '' # (your API key here)
gmap = gmplot.GoogleMapPlotter(37.766956, -122.438481, 13, apikey=apikey)

gmap.directions(
    (37.799001, -122.442692),
    (37.832183, -122.477914),
    waypoints=[
        (37.801036, -122.434586),
        (37.805461, -122.437262)
    ]
)

gmap.draw('map.html')

Clone this wiki locally