Search code examples
cocoa-touchgpscllocationmanagerroute-me

How Find Boundary of Loaded Map Tiles on Route Me Open Source Map?


Using following open source Route Me app I am loading Maptiles

mapview = [[RMMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)];
[mapview setBackgroundColor:[UIColor whiteColor]];
mapview.delegate = self;

id <RMTileSource> tileSource = [[[RMDBMapSource alloc] initWithPath:"@tilefile.db"] autorelease];

RMMapContents *rmcontents = [[RMMapContents alloc] initWithView:mapview tilesource:tileSource]; 
[self.view addSubview:mapview];//attached to mapview

It would be great if there is a method in RMMapContents that lets me get maps 4 corners as CLLocationCoordinate2D? There is a

- (RMSphericalTrapezium) latitudeLongitudeBoundingBox; 

How do I get the 4 corner location from above method?


Solution

  • You have to write yourself such a method:

    RMSphericalTrapezium trap;
    CLLocationCoordinate2D nePoint = CLLocationCoordinate2DMake(
        trap.northeast.latitude,
        trap.northeast.longitude);
    

    The remaining 3 points, use southeast, southwest and northwest, analog to above.