google map static drawing “route” instead of straight line

后端 未结 4 1684
傲寒
傲寒 2020-12-15 11:48

I succeeded in getting a google static map displaying a path between 2 coordinates.

The problem is that the drawn path is just a straight line between the 2 points.<

4条回答
  •  一整个雨季
    2020-12-15 12:17

    You can definitely do this with the Static Maps API:

    get directions using DirectionsService:

    http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsService

    and convert the overview path to suit the requirements of the Static Maps API:

    http://code.google.com/apis/maps/documentation/staticmaps/#Paths

提交回复
热议问题