Questions tagged [mkcoordinateregion]

MKCoordinateRegion is used to define a specific portion of a map in Map Kit.

MKCoordinateRegion is used to define a specific portion of a map in Map Kit. It comprises a center coordinate and longitude and latitude deltas which are applied equally to keep the coordinate centered.

For more information, see the Apple Documentation for MKCoordinateRegion.

80 questions
46
votes
11 answers

Convert MKCoordinateRegion to MKMapRect

I have a square MKMapView in my app, and I wish to set a center point and the exact height/width of the view in meters. Creating an MKCoordinateRegion and setting the map to it (as in this code... MKCoordinateRegion region =…
Jon Cox
  • 10,622
  • 22
  • 78
  • 123
20
votes
10 answers

How to check if MKCoordinateRegion contains CLLocationCoordinate2D without using MKMapView?

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 =…
Lukasz
  • 19,816
  • 17
  • 83
  • 139
17
votes
9 answers

MKMapView show incorrectly saved region

I'm saving map region into user defaults when my iPhone app is closing like this: MKCoordinateRegion region = mapView.region; [[NSUserDefaults standardUserDefaults] setDouble:region.center.latitude…
16
votes
3 answers

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

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…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
14
votes
3 answers

Get TopLeft and BottomRight from MKCoordinateRegion MKMapView

I checked the properties in documentation for MKCoordinateRegion, MKCoordinateSpan and MKMapView to see there is a way to get the TopLeft and BottomRight Lat Long from the map view and I didn't find any. I know that the span gives me the Lat long…
Dave
  • 4,038
  • 9
  • 45
  • 57
10
votes
2 answers

SwiftUI Using MapKit for Address Auto Complete

I have a form where the user enters their address. While they can always enter it manually, I also wanted to provide them with an easy solution with auto complete so that they could just start typing their address and then tap on the correct one…
kittonian
  • 1,020
  • 10
  • 22
8
votes
3 answers

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

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…
Alan Moore
  • 6,525
  • 6
  • 55
  • 68
7
votes
1 answer

MKCoordinateSpanMake: why specify longitude AND latitude delta?

If the distance corresponding to one degree of longitude is a function of latitude, why do you have to specify longitudeDelta and latitudeDelta when calling MKCoordinateSpanMake in the iOS MapKit? Moreover, how am I supposed to know what the correct…
serverpunk
  • 10,665
  • 15
  • 61
  • 95
5
votes
3 answers

How to make the union between two MKCoordinateRegion

I'm trying to do the union between two MKCoordinateRegion. Does anybody have an idea on how to do this?
5
votes
1 answer

@App Storage and MKCoordinateRegion Function

Is it possible to save an MKCoordinateRegion Value in @App Storage? I tried this. But it doesn't work. I got the error 'No exact matches in call to initializer' . @AppStorage("region_key") var region = MKCoordinateRegion( center:…
comhendrik
  • 239
  • 2
  • 11
5
votes
2 answers

How to create an MKCoordinate region similar to 50 miles radius in ios Swift?

I'm trying to create a region similar to a circle radius using CLLocation. I understand radius logic and how its measured in meters, but not so clear on a MKCoordinate region and how long delta and lat delta translate to area. I would like to get…
Charles Jr
  • 8,333
  • 15
  • 53
  • 74
5
votes
1 answer

Enlarge MKCoordinateRegionForMapRect For some margin

I have some annotations presented on a map (somepoints) the map zooms in or out to fit all points - see working code below. MKPolygon *poly = [MKPolygon polygonWithPoints:somepoints count:i]; [self.mapView…
chewy
  • 8,207
  • 6
  • 42
  • 70
4
votes
2 answers

MKCoordinateRegion distance between center and borders

(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…
4
votes
0 answers

MapKit Zooming Issues

I have a map in my app that start as a small map and becomes large after the user clicks it. Here it is in iOS 10 and iOS 11 side by side (small) When the user taps the map, it becomes full screen and appears as such (again iOS 10 - iOS 11): AS…
daredevil1234
  • 1,303
  • 1
  • 10
  • 34
4
votes
2 answers

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

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…
Krismutt
  • 191
  • 2
  • 16
1
2 3 4 5 6