سؤال

I am implementing map based application in iPhone sdk. I want to give functionality in map view like Google maps directoins. means is at some location from that he selects one pin from multiple pins from MKPinAnnotationView. is it possible that user can get direction from his current location to selected pin location in MapView? user can select any aanonations from that he can get directions in some way of line to his current location to pin location. i have get some idea from here

but this all was some static data you can download this example. here also apple example. but this example is only for track & draw line for user movement. is it possible that user can get direction from his current location to selected pin location in MapView?

هل كانت مفيدة؟

المحلول 2

I have got all side idea from here this can be useful for other developers also. i have found some other examples also that can be also useful for other developers just google. you will find this is polyline link for user current location use this apple code

نصائح أخرى

Yes. You can send a query to google maps api using your current location and the selected annotation location. When google responds with the route, you will use that polyline decoder method to decode the data and draw the route on your map view.

Here is Google direction api. Read it and use it.

For test purpose you can check this request
http://maps.googleapis.com/maps/api/directions/json?origin=28.459497,77.026638&destination=28.435600,77.009997&sensor=true
And use JSON Viewer to see the json response.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top