Google Map Route Draw on IPhone

后端 未结 6 861
天涯浪人
天涯浪人 2020-12-07 15:09

I am developing an application that has two versions. One for web and another for iPhone.

In the web app, I am able to draw a route on the road (drawing the route a

6条回答
  •  Happy的楠姐
    2020-12-07 15:53

    1. use this url to create a json/xml file http://maps.googleapis.com/maps/api/directions/output?parameters (read code.google.com/apis/maps/documentation/directions/ for more reference)

    2. parse the json/xml file

    3. in routes - legs - steps - polyline you can see points which are in encoded format

    4. decode those points (refer http://fkn1337.com/decode-google-maps-polylines-objective-c/) and make a CLLocationCoordinate2D array

    5. Use

    (MKPolyline *)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count

    for creating an MKPolyline object

    6 Using MKMapview's addOverlay we can create an overlay with direction

提交回复
热议问题