mkcoordinateregion

MKCoordinateRegion distance between center and borders

北慕城南 提交于 2020-01-01 12:31:31
问题 (Revised Question based on comment:) OK I will try to ask in other way...How can I get border coordinates of this circle overlay: (Original Question:) I am having weird problem with my iPhone app. I have MKCoordinateRegion which has center coordinate latitude: 51.509980 and longitude: -0.133700. I have used method MKCoordinateRegionMakeWithDistance and set the distance to be 16,093.44 meters (10 miles). I want to get border point of this region therefore I have this code: MKCoordinateRegion

MKCoordinateRegion distance between center and borders

徘徊边缘 提交于 2020-01-01 12:31:22
问题 (Revised Question based on comment:) OK I will try to ask in other way...How can I get border coordinates of this circle overlay: (Original Question:) I am having weird problem with my iPhone app. I have MKCoordinateRegion which has center coordinate latitude: 51.509980 and longitude: -0.133700. I have used method MKCoordinateRegionMakeWithDistance and set the distance to be 16,093.44 meters (10 miles). I want to get border point of this region therefore I have this code: MKCoordinateRegion

Unable to change MKMapView region(location)

拈花ヽ惹草 提交于 2019-12-12 04:56:15
问题 I am using split view controller in my application. Left panel(Master View Controller) holds table view with list of hotels and on right, the Detail View Controller contains MapView for displaying the location. Initially I am displaying the current location upon application launch. Then after selecting a value from table view, I am trying to show the hotel location in the map. Unfortunately even upon passing proper latitude & longitude values, I am still not able to change the region and I

How do I determine if the current user location is inside of my MKCoordinateRegion?

陌路散爱 提交于 2019-12-05 23:22:26
问题 I have a coordinate region that I have determined contains the limits of what I want to show for my app. I have set this up as an MKCoordinateRegion with center point lat, longitude and a span. How do I determine if the current userLocation is inside of my coordinate region? 回答1: Use map rects. Here's an example using the map's current visible rect. With regards to your question, you could use convertRegion:toRectToView: to first convert your region to a MKMapRect beforehand. MKMapPoint

Trying to get the span size in meters for an iOS MKCoordinateSpan

大兔子大兔子 提交于 2019-12-03 07:32:32
问题 When I need to make an MKCoordinateRegion , I do the following: var region = MKCoordinateRegion .FromDistance(coordinate, RegionSizeInMeters, RegionSizeInMeters); very simple - works perfectly. Now I wish to store the value of the current region span . When i look at the region.Span value, it’s an MKCoordinateSpan which has two properties: public double LatitudeDelta; public double LongitudeDelta; How can I convert the LatitudeDelta value into a latitudinalMeters please? (So then I can

Trying to get the span size in meters for an iOS MKCoordinateSpan

房东的猫 提交于 2019-12-02 22:25:01
When I need to make an MKCoordinateRegion , I do the following: var region = MKCoordinateRegion .FromDistance(coordinate, RegionSizeInMeters, RegionSizeInMeters); very simple - works perfectly. Now I wish to store the value of the current region span . When i look at the region.Span value, it’s an MKCoordinateSpan which has two properties: public double LatitudeDelta; public double LongitudeDelta; How can I convert the LatitudeDelta value into a latitudinalMeters please? (So then I can recreate my region (later on) using the above method... Hannes As I can see you already have the region of

Updating MKMapView to CLPlacemark returned from CLGeocoder

只愿长相守 提交于 2019-12-01 07:09:28
问题 I want to be able to update the region displayed on a MKMapView by allowing the user to type in an address or location in a UIAlertView. I currently have: if (geocoder.geocoding) [geocoder cancelGeocode]; [geocoder geocodeAddressString:[[alertView textFieldAtIndex:0] text] completionHandler:^(NSArray *placemarks, NSError *error) { if (!error) { NSLog(@"Found a location"); } else { NSLog(@"Error in geocoding"); } NSLog(@"Num found: %d", [placemarks count]); CLPlacemark *placemark = [placemarks

Zoom to fit region for all annotations - ending up zooming in between annotations

拥有回忆 提交于 2019-11-30 15:30:32
I have a problem with fitting all my annotations to the screen... sometimes it shows all annotations, but some other times the app is zooming in between the two annotations so that none of them are visible... I want the app to always fit the region to the annotations and not to zoom in between them... what do I do wrong? if ([mapView.annotations count] == 2) { CLLocationCoordinate2D SouthWest = location; CLLocationCoordinate2D NorthEast = savedPosition; NorthEast.latitude = MAX(NorthEast.latitude, savedPosition.latitude); NorthEast.longitude = MAX(NorthEast.longitude, savedPosition.longitude);

Zoom to fit region for all annotations - ending up zooming in between annotations

僤鯓⒐⒋嵵緔 提交于 2019-11-29 22:02:46
问题 I have a problem with fitting all my annotations to the screen... sometimes it shows all annotations, but some other times the app is zooming in between the two annotations so that none of them are visible... I want the app to always fit the region to the annotations and not to zoom in between them... what do I do wrong? if ([mapView.annotations count] == 2) { CLLocationCoordinate2D SouthWest = location; CLLocationCoordinate2D NorthEast = savedPosition; NorthEast.latitude = MAX(NorthEast

How to check if MKCoordinateRegion contains CLLocationCoordinate2D without using MKMapView?

六眼飞鱼酱① 提交于 2019-11-28 17:36:42
I need to check if user location belongs to the MKCoordinateRegion. I was surprised not to find simple function for this, something like: CGRectContainsCGPoint(rect, point) . I found following piece of code: CLLocationCoordinate2D topLeftCoordinate = CLLocationCoordinate2DMake(region.center.latitude + (region.span.latitudeDelta/2.0), region.center.longitude - (region.span.longitudeDelta/2.0)); CLLocationCoordinate2D bottomRightCoordinate = CLLocationCoordinate2DMake(region.center.latitude - (region.span.latitudeDelta/2.0), region.center.longitude + (region.span.longitudeDelta/2.0)); if