googlemaps / google-maps-services-python

Python client library for Google Maps API Web Services
Apache License 2.0
4.56k stars 1.31k forks source link

FR: allow lat/lng str instead of float #503

Open dotysan opened 1 year ago

dotysan commented 1 year ago

Is your feature request related to a problem? Please describe. A multi-location elevation() request throws an err when the locs are a list of lat/lng strings.

Describe the solution you'd like I would have expected this to work.

locations = [('40.714728', '-73.998672'), ('-34.397', '150.644')]
results = client.elevation(locations)

Since I'm retrieving them from json text and googlemaps eventually returns them as json text, why require manual/interim conversion to floats?

Additional context It appears this might be due to the polyline encoding. But still...why is that mandatory for small lists of coords?

wangela commented 1 year ago

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@dotysan Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

dotysan commented 1 year ago

Thx @wangela, the workaround (float(lat), float(lng)) is simple enough. But still seems unnecessary for my needs since (lat, lng) is already a valid tuple of str coords. Although I could be missing something.

dotysan commented 1 year ago

Also, in my example lat/lng are already formatted strings that represent the precision. After float() that is lost. And I now have to re-format the float back to the proper precision string.