Results 1 to 10 of 10

Thread: Routing between 2 annotations moves 1st annotation to location of 2nd Annotation

  1. #1
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36

    Routing between 2 annotations moves 1st annotation to location of 2nd Annotation

    I'm using the Skobbler iOS SDK with Swift, iOS 9, xCode 7.0.1

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

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

    Thanks!



    Here is the code used to create the annotations and routing.


    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(r oute)
    }

    func routingService(routingService: SKRoutingService!,
    didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
    routingService.zoomToRouteWithInsets(UIEdgeInsetsZ ero, duration: 400)
    }
    Attached Images Attached Images
    Last edited by jimt2000; 26.10.2015 at 16:40. Reason: Format code

  2. #2
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    This is a similar problem to my problem (http://forum.skobbler.com/showthread...hen-zooming-in) . Looking forward to a solution.

  3. #3
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    Skobbler? Does anyone monitor this forum?

  4. #4
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Hi Jimt2000,

    We confirm that this issue is on our developers' list. We'll update this thread as soon as we have an answer.

  5. #5
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    Thank you.

  6. #6
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    Does one of your annotations have the identifier 0 by any chance?
    By dumb luck I found out that, in my case, this mysterious behaviour occurs for the annotation with identifier 0 (zero). If I change the identifier to 1 for example the mysterious behaviour is gone (in my case).
    My guess is, but perhaps you (Adela) can confirm, is that somehow the 0 identifier is reserved for the current location (indicator).

  7. #7
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    In my code, I find just the opposite.
    If I have two annotations with identifiers of 0, and 1. I do NOT get the problem.
    If I have two annotations with identifiers of 1 and 2, I DO get the problem.

  8. #8
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    Hmmm...very strange. Well, at least we know now it has something to do with the identifiers. I'm working on updating my full code on this today. Let you know if I find anything else. Perhaps also the Skobbler guys can shed some light on this, now that they have this new info?

  9. #9
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    Our developers are investigating the problem but to be on the safe side of things, switch to using annotation ids > 10.

    At some point in time the ID 0 was used for the destination flag annotation - we're looking now at the code base to see what is the current implementation.

  10. #10
    Etablierter skobbler
    Join Date
    26.10.2015
    Posts
    36
    Thanks. I'm not seeing the problem when using IDs > 10.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •