开发者

Draw a Route between starting point to end point in google mapview

I am developing a Demo project in Xcode to draw a route between two places.

For example, from a particular starting place to end place according to latitude and longitude. However, I could not understand how to do it? With the help of google api or 开发者_C百科from any other process?


To draw a line between the starting point and ending point the best place to start is the Apple Source Code Here, it does everything and more: http://developer.apple.com/library/ios/#samplecode/Breadcrumb/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010048-Intro-DontLinkElementID_2


You need to make a request to http://maps.google.com/maps?dirflg=w&output=dragdir&saddr=lat,lng&daddr=lat,lng ( more information on parameters can be found here: http://mapki.com/wiki/Google_Map_Parameters#Directions )

It will return points in encoded format, decode them using code from http://fkn1337.com/decode-google-maps-polylines-objective-c/

Construct MKPolyline object from this points and add it to the map.


If you want to draw route between two points in map view it is better to use Regexkitlite framework classes which will describe clearly how to achieve this.For reference and sample code go through this link.

http://sugartin.info/2011/10/12/drawing-route-on-google-map-mkmapview

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜