3

I'm using the MapBox SDK with an offline map. I'm adding a RMPath overlay to the mapView and everything is shown ok.

problem no. 1: while scrolling the map the RMPath overlay is scrolled also, but sometimes it is drawn with an offset (a location where it was just a moment ago) for just a fraction of a second, after that it gets to it's normal place , and this creates a sensation of flickering. Why this happens and how can I get rid of it?

problem no. 2: while scrolling the map the RMMarker and RMPath overlay "vibrates", it's like the overlay tries to "catch up" with it's normal position when the map is scrolled. It's just a few pixels, but when zoomed it looks pretty bad. this happens most probably because the -draw() method is called only when the map is moved more than just a pixel. How can I make the overlays scroll smoother?

My searches resulted with absolutely nothing, so any help is welcomed.

p.s. tested on iPhone3GS and iPhone4S, same problems on both.

mouse.4d
  • 83
  • 1
  • 6
  • I cannot answer your specific question but there were similar problems with the Alpstein fork of the route-me library, which is the basis for the MapBox SDK. I would advise you to either post your question to the route-me google group (as the MapBox SDK developer is reading that list) or, even better, to open an issue on the MapBox SDK github site (https://github.com/mapbox/mapbox-ios-sdk/issues). – Jan Christiansen Jul 26 '12 at 10:58

2 Answers2

0

RMPath is deprecated, try using RMShape instead. Also do not forget to set the bounding box of your annotation before adding it to the map (setBoundingBoxFromLocations can be useful).

Example :

pathAnnotation = [[RMAnnotation alloc]initWithMapView:mapView    coordinate:CLLocationCoordinate2DMake(long,lat) andTitle:@"path"];
[pathAnnotation setBoundingBoxFromLocations:pathLocations];

and then in your layerForAnnotation() :

RMShape *path = [[RMShape alloc] initWithView:mapView] ;
[path setLineColor:[UIColor colorWithRed:0.2 green:0.7 blue:1 alpha:0.7]];
[path setLineWidth:4];

// Create real coordinates from data
for(int idx = 0; idx < pathPoints.count; idx++)
{

    CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(pathPoints[idx].latitude,pathPoints[idx].longitude);

    // First point
    if( idx == 0){
        [path moveToCoordinate:coord];
    }else{
        [path addLineToCoordinate:coord];
    }
}
return path;
Alexis C.
  • 4,898
  • 1
  • 31
  • 43
0

For your problem n°2, I think this could be relative to this issue on MapBox ios sdk

For problem n°1, I have noticed the same behavior, but only when annotations are added while the map is scrolling/zooming. After the map stabilized, the annotations go to the right position. I am still investigating for that.