How to add markers on Google Maps polylines based on distance along the line?

后端 未结 5 1683
小蘑菇
小蘑菇 2020-12-02 07:12

I am trying to create a Google Map where the user can plot the route he walked/ran/bicycled and see how long he ran. The GPolyline class with it’s getLeng

5条回答
  •  生来不讨喜
    2020-12-02 07:51

    I wanted to port Daniel Vassalo's answer to iOS, but it wasn't worked properly and some markers were misplaced until I changed

    var dLon = (point.lng() - this.lng()).toRad();
    

    to

    var dLon = point.lng().toRad() - this.lng().toRad();
    

    So if anyone having a trouble to figure out why are the markers are misplaced, try this and maybe it will help.

提交回复
热议问题