googleapis/google-api-ruby-client

Optimize route option work incorrect

zphutvz opened this issue · 1 comments

Hello guys,
I have a problem when using google api find route with optimize route option
optimize_route = false -> total route is 21km
optimize_route = true -> total route is 23km
I turned off avoid options, I double-checked on Google map web and the result actually wrong

Environment details

  • Ruby version: 2.5.3
  • Gem name and version: 'google-api-client', '~> 0.20.1'

Steps to reproduce

This is list of locations happens the error:

[
    {
        "latitude": 10.800841255712163,
        "longitude": 106.65971765401387,
        "name": "55 Cộng Hòa, Phường 4, Tân Bình, Thành phố Hồ Chí Minh, Vietnam"
    },
    {
        "latitude": 10.803370415360932,
        "longitude": 106.74190473390459,
        "name": "159 Xa lộ Hà Nội, Thảo Điền, Quận 2, Thành phố Hồ Chí Minh, Vietnam"
    },
    {
        "latitude": 10.775968596574188,
        "longitude": 106.75271940065264,
        "name": "11 Lê Hiến Mai, Phường Thạnh Mỹ Lợi, Quận 2, Thành phố Hồ Chí Minh 70000, Vietnam"
    },
    {
        "latitude": 10.780943266091418,
        "longitude": 106.73366498781084,
        "name": "QPJM+4VJ, Phường Bình Khánh, Quận 2, Thành phố Hồ Chí Minh, Vietnam"
    }
]

if use optimize route option, the 2 last locations are swapped positions, which makes the error
*Locations belongs to Vietnam

Has anyone had this problem before?

Version 0.20 of the google-api-client gem is extremely old (more than 3.5 years old). Furthermore, the google-api-client gem itself is deprecated. We broke it up into separate gems for each API about a year ago. I recommend that you update to the latest version of the individual API gem corresponding to the service and service version that you are using. (Its name will start with google-apis-.)

If you still see this issue with an updated gem, please open an issue with the particular service that you are calling. You can usually find an issue tracker link on the documentation pages for the service (often on developers.google.com or cloud.google.com).