I have two text-boxes in which user enters his source and destination,开发者_运维技巧 when user presses submit button one marker is drawn at source and other one is drawn at destination so can any one tell me how to find the mid locations? Using google map api version3.
You can do a directions request between the two points. This will render a polyline on the map for the driving directions between the two points.
Just do a little bit of math. You basically want to find the midpoint of two points on a line, following this formula:
x1 + x2 ------- 2
You'll want to do this twice, once for latitude and once for longitude. Then you can place a marker on your map.
精彩评论