Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Precision of zoomWithLatitudeLongitudeBoundsSouthWest #551

Open
benjaminbarbe opened this issue Dec 2, 2014 · 3 comments
Open

Precision of zoomWithLatitudeLongitudeBoundsSouthWest #551

benjaminbarbe opened this issue Dec 2, 2014 · 3 comments
Labels

Comments

@benjaminbarbe
Copy link

Hi,

I'm experiencing an issue with the precision of zoomWithLatitudeLongitudeBoundsSouthWest. As you can see below, my map start with a bounding box of (12.965657,-49.285990 66.833126,28.444060) and when I call zoom to current, there are an unexpected latitude change.

My current use-case is to save a bounding box to retrieve later. This is the simplest code to explain the problem.

# XCODE console output
2014-12-02 19:37:17.344 MyViewer[24944:433989] 12.965657 -49.285990 66.833126 28.444060
2014-12-02 19:37:44.773 MyViewer[24944:433989] 4.722490 -49.285990 63.320088 28.444060
- (void)mapViewRegionDidChange:(RMMapView *)mapView
{
    RMSphericalTrapezium sphericalTrapezium = [mapView latitudeLongitudeBoundingBox];
    NSLog(@"%f %f %f %f", sphericalTrapezium.southWest.latitude, sphericalTrapezium.southWest.longitude,
        sphericalTrapezium.northEast.latitude, sphericalTrapezium.northEast.longitude);
}

- (void)zoomToCurrent
{
    RMSphericalTrapezium sphericalTrapezium = [mapView latitudeLongitudeBoundingBox];

    CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(sphericalTrapezium.southWest.latitude, sphericalTrapezium.southWest.longitude);
    CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(sphericalTrapezium.northEast.latitude, sphericalTrapezium.northEast.longitude);

    [mapboxview.mapView zoomWithLatitudeLongitudeBoundsSouthWest:southWest northEast:northEast animated:NO];
}

Do you have any ideas?

Thanks

@incanus incanus added the bug label Dec 3, 2014
@benjaminbarbe
Copy link
Author

@incanus Do you have any update on this? 😄

@benjaminbarbe
Copy link
Author

@incanus I would like to help solve the problem but I do not know where to look? Could you give me a starting point?

Thanks

@stcleezy
Copy link

stcleezy commented Apr 5, 2015

I have a similar issue, but only when using with devices that do not have HD retina display (anything before iPhone 6).

The code is quite basic:

override func viewWillAppear(animated: Bool) {

    //stuff...

    //this works on iPhone 6 and 6 Plus, but not on other phones
    mapView.zoomWithLatitudeLongitudeBoundsSouthWest(CLLocationCoordinate2DMake(sw_latitude,sw_longitude), northEast: CLLocationCoordinate2DMake(ne_latitude, ne_longitude), animated: true)

}

I make a similar call outside of viewWillAppear and it works fine across all devices.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants