After some thorough and dead-end hitting experiments I’m unable to figure this out. So, my first thought was to filter out received points (1980) from the original point list (2000), which should have given me 20 points. But I was getting some 336 points. Here’s where I found another issue. Many of the returned lat/long values had been rounded off and thats why
latLng1 != latLng2. For eg. (latitude=12.9334, longitude=77.59906) was returned as (latitude=12.9334, longitude=77.59905). The last digit in longitude has changed and even though its not a major change, latLng1 == latLng2 logic was breaking. So thats another issue.
Coming back to the main issue, I hit the api with a polyline containing 50 points and received 48 points. Here are the requested and received polylines.
Requested Polyline (without elevation data)
Received Polyline (containing elevation data)
And after looking closely, these two points were missing from the original polyline -
When I hit the elevation/point API, its working for these points, but somehow not being returned in the polyline.
Thats all I could figure out. I hope this info helps.