我使用此代码但是用于查找两点之间的路线,但我需要使用location
地图基于device moving
更新skobbler
。
-(void)Draw_Route
{
SKRouteSettings* route = [[SKRouteSettings alloc]init];
route.startCoordinate=prevlocation;//CLLocationCoordinate2DMake(13.0270, 80.2602);
//prevlocation;
//CLLocationCoordinate2DMake(13.5, 80.21);//CLLocationCoordinate2DMake(37.9667, 23.7167);
route.destinationCoordinate=currentUserLocation;
//currentLocation.coordinate;//CLLocationCoordinate2DMake(13.0270, 80.2602);//currentLocation.coordinate;//CLLocationCoordinate2DMake(37.9677, 23.7567);
route.shouldBeRendered = YES; // If NO, the route will not be rendered.
route.requestAdvices = YES;
route.maximumReturnedRoutes = 1;
route.requestExtendedRoutePointsInfo = NO;
[[SKRoutingService sharedInstance] calculateRoute:route];
SKAnnotation *startCoordinateAnnotation = [SKAnnotation annotation];
startCoordinateAnnotation.identifier = 9998;
startCoordinateAnnotation.annotationType = SKAnnotationTypeGreen;
startCoordinateAnnotation.location = route.startCoordinate;
[skMapView_ addAnnotation:startCoordinateAnnotation withAnimationSettings:nil];
//add destination flag annotation
SKAnnotation *destinationFlagAnnotation = [SKAnnotation annotation];
destinationFlagAnnotation.identifier = 9999;
destinationFlagAnnotation.annotationType = SKAnnotationTypeDestinationFlag;
destinationFlagAnnotation.location = route.destinationCoordinate;
[skMapView_ addAnnotation:destinationFlagAnnotation withAnimationSettings:nil];
}