i'm trying display route between points on map. i'm using mapbox, tell me if i'm doing wrong way, i'm using mkdirectionsrequest in order mkmappoint need display route mapbox class rmpolylineannotation. mkdirectionsrequest returns unusable coordinates:
<__nsarraym 0x7fd88bfa6810>(<+43224681.35381404,+104172185.41666411> +/- 0.00m (speed -1.00 mps / course -1.00) @ 4/28/15, 10:31:51 central european summer time, ...)
when print mkdirectionsrequest.source object before calling directions api (the coordinates correct):
<mkmapitem: 0x7fca6ad48de0> { iscurrentlocation = 0; name = "unknown location"; placemark = "<+37.33233141,-122.03121860> +/- 0.00m, region clcircularregion (identifier:'<+37.33233141,-122.03121860> radius 0.00', center:<+37.33233141,-122.03121860>, radius:0.00m)"; }
here code:
mkdirectionsrequest *directionsrequest = [[mkdirectionsrequest alloc] init]; mkplacemark *sourceplacemark = [[mkplacemark alloc] initwithcoordinate:_usercoordinates addressdictionary:nil]; mkplacemark *destinationplacemark = [[mkplacemark alloc] initwithcoordinate:carcoordinates addressdictionary:nil]; directionsrequest.source = [[mkmapitem alloc] initwithplacemark:sourceplacemark]; directionsrequest.destination = [[mkmapitem alloc] initwithplacemark:destinationplacemark]; directionsrequest.transporttype = mkdirectionstransporttypewalking; directionsrequest.requestsalternateroutes = no; mkdirections *directions = [[mkdirections alloc] initwithrequest:directionsrequest]; [directions calculatedirectionswithcompletionhandler:^(mkdirectionsresponse *response, nserror *error) { if (error) { // handle error } else { nsmutablearray *routepoints = [[nsmutablearray alloc] init]; mkroute *route = response.routes[0]; (nsuinteger = 0; < route.polyline.pointcount; i++) { mkmappoint point = route.polyline.points[i]; cllocation *location = [[cllocation alloc] initwithlatitude:point.x longitude:point.y]; [routepoints addobject:location]; } rmpolylineannotation *polylineannotation = [[rmpolylineannotation alloc] initwithmapview:_mapview points:[routepoints copy]]; [polylineannotation setlinewidth:10.0f]; [polylineannotation setlinecolor:[uicolor orangecolor]]; [_mapview addannotation:polylineannotation]; } }];
many :)