Outdooractive / route-me

Open source map library for iOS
Other
122 stars 400 forks source link

Coordinates become 0 no matter what I set them too. (centerCoordinate) using RMTileSource #134

Open SudoPlz opened 11 years ago

SudoPlz commented 11 years ago

My code is this

//Creating the point
CLLocationCoordinate2D centerPoint;
 centerPoint.latitude = 36.966029;
 centerPoint.longitude = -121.977739;

//print out its contents
NSLog(@"Coords should be: lat %f,long %f ", centerPoint.latitude,centerPoint.longitude);

// create the map view
_map = [[RMMapView alloc]
            initWithFrame: self.view.bounds
            andTilesource:cartoSource
            centerCoordinate:centerPoint
            zoomLevel:6
            maxZoomLevel:18
            minZoomLevel:1
            backgroundImage:nil];

//print out its centerCoordinates
NSLog(@"NEW coords: lat %f,long %f ", _map.centerCoordinate.latitude,_map.centerCoordinate.longitude);

//set the center coordinates AGAIN
[_map setCenterCoordinate:centerPoint animated:0];

//print out centerCoordinates
NSLog(@"NEW coords: lat %f,long %f ", _map.centerCoordinate.latitude,_map.centerCoordinate.longitude);

The NSLogs print out the following:

Coords should be: lat 36.966029,long -121.977739 
NEW coords: lat 0.000000,long 0.000000 
NEW coords: lat 0.000000,long 0.000000 
NEW coords: lat 0.000000,long 0.00 000

No matter what coordinates I set my centerCoordinate to, it is always 0. The same does not happen when I use another constructor like say [initWithFrame:];

What am I doing wrong? Is this a bug?

incanus commented 11 years ago

See also https://github.com/mapbox/mapbox-ios-sdk/issues/306