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

decode_polyline does not support elevation #9

Closed
swissembedded opened this issue Aug 11, 2018 · 2 comments
Closed

decode_polyline does not support elevation #9

swissembedded opened this issue Aug 11, 2018 · 2 comments
Labels
bug Something isn't working
Projects

Comments

@swissembedded
Copy link

swissembedded commented Aug 11, 2018

import openrouteservice

API_KEY = "123"
client = openrouteservice.Client(key = API_KEY, base_url = 'https://api.openrouteservice.org')

Handegg 6, Guttannen: 46.6122285, 8.3075423

Dorfstrasse, Innertkirchen: 46.70533443143516, 8.227912878765892

down = ((8.3075423,46.6122285 ),(8.227912878765892,46.70533443143516))
up = ((8.227912878765892,46.70533443143516),(8.3075423,46.6122285))

coords=up
geometry = client.directions(coords, profile='driving-car', preference='shortest',units='km',language='en', geometry='true', geometry_format='encodedpolyline', elevation='true', extra_info=['steepness'])
decoded = openrouteservice.convert.decode_polyline(geometry)
print(decoded)

$ py orstest.py
Traceback (most recent call last):
File "orstest.py", line 13, in
decoded = openrouteservice.convert.decode_polyline(geometry)
File "C:\Users\m50\AppData\Local\Programs\Python\Python36\lib\site-packages\openrouteservice\convert.py", line 150, in decode_polyline
b = ord(polyline[index]) - 63 - 1
KeyError: 0

@nilsnolde nilsnolde assigned nilsnolde and unassigned nilsnolde Aug 14, 2018
@nilsnolde nilsnolde added the bug Something isn't working label Aug 14, 2018
@nilsnolde
Copy link
Contributor

Thanks for creating the first real issue:)

I'll have someone take a look at this asap. The original code was taken from the Google Maps client, I didn't check for elevation.

@nilsnolde
Copy link
Contributor

Finally done and merged into master. A v1 will soon be available on PyPI, but feel free to test the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
ors-py 1.0
  
Awaiting triage
Development

No branches or pull requests

2 participants