[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know the command to check the return value of Usage's directions_result #208

Closed
hyuraku opened this issue Nov 25, 2017 · 1 comment

Comments

@hyuraku
Copy link
hyuraku commented Nov 25, 2017

Environment

macOS Sierra 10.12.6
python:3.5.2
googlemaps:2.5.1

Problem

I try to show the output of directions_result by print method, but the returning data was not readable and I could not check the output.

I wrote sample1.py based on the code of the link below.. I wrote the code below.
https://github.com/googlemaps/google-maps-services-python#usage

sample1.py

import googlemaps
from datetime import datetime

gmaps = googlemaps.Client(key='MY_API_KEY')

# Geocoding an address
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')

# Look up an address with reverse geocoding
reverse_geocode_result = gmaps.reverse_geocode((40.714224, -73.961452))

# Request directions via public transit
now = datetime.now()
directions_result = gmaps.directions("Sydney Town Hall",
                                     "Parramatta, NSW",
                                     mode="transit",
                                     departure_time=now)

print(directions_result) #add new code.

Returned data is difficult for me like this:

(omit)
'polyline': {'points': 'b}vmEgr{y[ANbAHnAJ@?@?hDh@D?T?R?JCFAh@Kj@Uf@]b@_@b@e@LQLWLWLULUl@m@t@i@x@c@z@]d@MVI\I~AQn@CF@hAN@?L@H?H?^Dt@LZDHBB?
(omit)

Since the output is long, I put it in GithubGist and put it on the link below.
https://gist.github.com/hyuraku/ef1481f57d6cab8c44a9c2b2c3024d9f

What I expect

Please tell me any commands for the check the readable return value of directions_result if you have.

@stephenmcd
Copy link
Contributor

The points for steps are in polyline encoded format, please see the docs:

https://developers.google.com/maps/documentation/directions/intro#Steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants