3

I'm using the Skobbler ios SDK.

I add two annotations to my map view. Then I route between these two points. The routing succeeds, but the annotation (pin) for the first point, the starting point disappears -- Actually the first annotations moves behind the second annotation. If I look carefully at the second annotation (pins) at the end of the route, I can see that there is another annotation behind it.

The app shows an annotation's callout when I tap the annotation. If I carefully tap the annotation behind the the end point annotation, the callout for the first annotation at the beginning of the route appears in its original starting point location. The annotation at the beginning of the route has improperly (so it seems to me) moved behind the annotation at the end of the route, but its callout remains at the correct position at the beginning of the route.

Why is the first annotation moving, and how can I keep it at its original position.

Thanks!

EDIT: iOS 9, Swift.

Its pretty generic code taken from snippets at http://developer.skobbler.com/getting-started/

func mapView(mapView: SKMapView, didLongTapAtCoordinate coordinate: CLLocationCoordinate2D) {

    let annotation = ABPAnnotation()
    annotations.append(annotation)
    annotation.identifier = Int32(annotations.count)
    annotation.annotationType = SKAnnotationType.Red
    annotation.location = coordinate
    let animationSettings = SKAnimationSettings()
    mapView.addAnnotation(annotation, withAnimationSettings: animationSettings)

    self.mapView(mapView, didSelectAnnotation: annotation)
}

func mapView(mapView:SKMapView!, didSelectAnnotation annotation:SKAnnotation!) {
    mapView.calloutView.location = annotation.location
    mapView.calloutView.titleLabel.text = "Annotation"
    mapView.calloutView.subtitleLabel.text = "subtitle"
    mapView.showCalloutForAnnotation(annotation, withOffset: CGPointMake(0, 42), 
                                     animated: false);
}

@IBAction func routeAction(sender: AnyObject) {
    let route = SKRouteSettings()
    route.startCoordinate = annotations[0].location
    route.destinationCoordinate = annotations[1].location
    route.shouldBeRendered = true
    route.routeMode = SKRouteMode.CarEfficient
    route.maximumReturnedRoutes = 1
    route.routeRestrictions.avoidHighways = false
    route.requestAdvices = true
    SKRoutingService.sharedInstance().calculateRoute(route)
}

func routingService(routingService: SKRoutingService!,
             didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
    routingService.zoomToRouteWithInsets(UIEdgeInsetsZero, duration: 400)
}

Pin starting pin moved behind ending pin

SylviA
  • 1,577
  • 9
  • 13
jimmyg
  • 580
  • 4
  • 13
  • Please add the code you are using to add your annotations to this question (include the ids you are using for your annotations). Do you make any calls to updateAnnotation? – Ando Oct 23 '15 at 06:44
  • And is this an android or an iOS issue? – Ando Oct 23 '15 at 06:58
  • Edited: Added code. Using xcode 7.1, iOS 9 – jimmyg Oct 23 '15 at 12:54
  • Have a similar problem and posted it on the skobbler forum. I do have a workaround for it, mentioned in the forum. So far no real solution from Skobbler it seems. http://forum.skobbler.com/showthread.php/7079-iOS-Annotation-moves-when-zooming-in – guido Oct 30 '15 at 21:47
  • I saw your post in the Skobbler forum when I was looking for a solution. We're evaluating using Skobbler for a large deployment. It seems to fit really well what we need, but I'm a little disappointed not to have heard anything here, or on my post on the Skobbler forum. (http://forum.skobbler.com/showthread.php/7255-Routing-between-2-annotations-moves-1st-annotation-to-location-of-2nd-Annotation). – jimmyg Oct 31 '15 at 04:02
  • I can also replicate this issue on versions 2.5 and 2.5.1 on Android. Certain annotations that have been placed previously move to the location of another existing annotation when the user zooms/pans. If I click on the pin that moved, the map will pan automatically and the annotation will show in the location where the pin should have been displayed prior to having moved. – Keith Nov 13 '15 at 20:55

1 Answers1

1

As mentioned in my comment above, I was also experiencing this issue when using the Android Skobbler SDK (versions 2.5 and 2.5.1) but was able to find a workaround from these two forum posts: #1 and #2.

Basically, it seems that users have issues adding annotations that have an id of 0 or 1 which I could replicate in my own code as well.

To solve it in my case, I simply made sure that any annotation I created didn't have an id less than 10 and that fixed the issue for me.

So changing annotation.identifier = Int32(annotations.count) to something like annotation.identifier = Int32(annotations.count + SKOBBLER_ANNOTATION_OFFSET) where SKOBBLER_ANNOTATION_OFFSET is a value of 10 or greater might work for you.

Hope that helps, thanks!

Edit: Actually, I remembered now that credit for discovering this goes to seeing @guido's comment in the original question, so thank you for the pointer in the right direction there!

Keith
  • 811
  • 6
  • 18