Skip to content
This repository

Paths disappear at high zoom levels #18

mtoon opened this Issue · 7 comments

2 participants

mtoon Thomas Rasch

First, let me say thank you for this great refactoring of the route-me source. I've been using the original project for almost a year and I've just started updating my app to use this branch instead. I really like the fluid scrolling, much better memory management (still have yet to see a memory warning popup even on my testing iPad1) and the annotation/view paradigm (not to mention the CLLocationCoordinate2D usage and consolidated RMMapView and contents.

However, one thing I'm seeing that is a problem (at least for me) is that I can't seem to figure out how to just add static RMPaths to the map and then I implement them as annotations with layers, they are hidden at high zoom levels (for an obvious reason -- the "coordinate" of the path is offscreen so they are hidden). I experimented with adding a canHide boolean to the RMAnnotation and changing the RMMapView to check that before hiding it. That worked but then I ran across the invalid layer size issue.

Any thoughts?

Thank you!

Thomas Rasch

Hm, I never had issues with vanishing paths, and I use them a lot. Can you create a demo project that shows the issue?


FYI, it actually doesn't seem like a bug because the paths are between points that are far apart (100+ miles) and once you zoom in the associated annotations would be "hidden"... So, the behavior actually makes sense, but I need a way to show paths between two waypoints that are far apart at high zoom levels. So, any thoughts on how to create a static path between two points would be great!
p.s. I can whip up a working demo to try and flesh this functionality out if need be.

Thomas Rasch

A small demo would be great, so that I have something to play with. Since our products are fairly complicated and use most of the route-me functionality, I might know some not-so-obvious solution to this problem.

Thomas Rasch

BTW if you want an annotation to never be hidden, then you could also set the whole world as the bounding box for the annotation:

- (void)setBoundingBoxCoordinatesSouthWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast

Sounds good. I'll work on a demo later today and get it up. Also, your bounding box suggestion might be a perfect solution. I'm guessing if I drew a path between two far points and set the bounding box to be each point that would probably solve my disappearing route problem?

Thomas Rasch

Ah, now I see your problem. This is actually badly documented, I have to admit. You have to set the path bounding box for the annotation and the map view will do the rest. In my code, it looks like this (in a RMMapView category):

- (void)addPolyline:(NSArray *)linePoints withLineColor:(UIColor *)lineColor
    if ([linePoints count] < 2) return;

    linePoints = [GeoUtils reduceNumberOfCoordinates:linePoints to:900];

    RMAnnotation *polylineAnnotation = [RMAnnotation annotationWithMapView:self coordinate:((CLLocation *)[linePoints firstObject]).coordinate andTitle:nil];
    polylineAnnotation.annotationType = @"polyline";
    polylineAnnotation.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:linePoints,@"linePoints", lineColor,@"lineColor", nil];
    [polylineAnnotation setBoundingBoxFromLocations:linePoints];

    [self addAnnotation:polylineAnnotation];

linePoints is an array of CLLocations. So, setting the bounding box to the two endpoints should do the trick.

I think I should make this more evident...

mtoon mtoon closed this

Setting the bounding box worked perfectly, thank you! I'm going to try and implement the rest of the various items using annotations and see how that plays out before trying to implement static layers.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.