google-maps-services-python icon indicating copy to clipboard operation
google-maps-services-python copied to clipboard

FR: allow lat/lng str instead of float

Open dotysan opened this issue 2 years ago • 3 comments

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?

dotysan avatar Sep 26 '23 20:09 dotysan

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.

wangela avatar Sep 26 '23 20:09 wangela

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 avatar Sep 26 '23 20:09 dotysan

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.

dotysan avatar Sep 26 '23 20:09 dotysan