I am trying to calculate the latitudeDelta & longitudeDelta of visible map area on the phone screen. The two method used were:
spanLat = map.visibleMapRect.size.width / 111000;
spanLon = map.visibleMapRect.size.height / (111000 * cos(centreLat*3.14159/180));
And
MKMapRect mRect = map.visibleMapRect;
MKMapPoint eastMapPoint = MKMapPointMake(MKMapRectGetMinX(mRect), MKMapRectGetMidY(mRect));
MKMapPoint westMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect), MKMapRectGetMidY(mRect));
MKMapPoint northMapPoint = MKMapPointMake(MKMapRectGetMinY(mRect), MKMapRectGetMidX(mRect));
MKMapPoint southMapPoint = MKMapPointMake(MKMapRectGetMaxY(mRect), MKMapRectGetMidX(mRect));
CLLocationDistance wLength = MKMetersBetweenMapPoints(eastMapPoint, westMapPoint);
CLLocationDistance hLength = MKMetersBetweenMapPoints(northMapPoint, southMapPoint);
spanLat = wLength / 111000;
spanLon = hLength / (111000 * cos(centreLat*3.14159/180));
Neither gives me right latitudeDelta & longitudeDelta of the visible area.
Post
Replies
Boosts
Views
Activity
I have apps that send requests for route between 2 locations and search, filter then display facilities near the route. The apps first send a request for the route on a background thread, then based on route, search for facilities near certain locations on or near the route. There maybe multiple searches on the same route, each on a different location. Suitable results then are displayed on the map. Apps also do live updates.
However, since I have switched to using NSURLSession to search for the route on a background thread, not all suitable results/pin are displayed. Certain pins only show up upon the next didUpdateToLocation call.
So my question is, what is the best practice to sync the results on the UI? Why do only some of the results show up on the UI, and others don't.
I have apps that send requests for route between 2 locations and search, filter then display facilities near the route. The apps first send a request for the route on a background thread, then based on route, search for facilities near certain locations on or near the route. There maybe multiple searches on the same route, each on a different location. Suitable results then are displayed on the map. Apps also do live updates.
However, since I have switched to using NSURLSession to search for the route on a background thread, not all suitable results/pin are displayed. Certain pins only show up upon the next didUpdateToLocation call.
So my question is, what is the best practice to sync the results on the UI? Why do only some of the results show up on the UI, and others don't.