An iOS Map Kit data type: A rectangular area as measured on a two-dimensional map projection.
Questions tagged [mkmaprect]
31 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
8
votes
2 answers
How to keep pin and map centered above moving overlay in an MKMapView
How can I keep a pin centered on a map whilst I move (via Pan Gesture) another view vertically over the map such that the pin remains above the overlay (not an actual MapKit overlay).
See attached screenshots for the first and final states.
I've got…

Aodh
- 662
- 1
- 7
- 24
7
votes
4 answers
Failed to set maprect to show all annotations
I have 2 annotations to display on the mapview, but unable to set the maprect to show all of them on screen without requiring users to zoom out.
I tried with showAnnotations but no luck. Anyone has been able to do this in Swift and Xcode 6.1.1?…

tala9999
- 1,540
- 2
- 15
- 25
6
votes
1 answer
Convert MKMapRect to CGRect
I'm trying to find out the size of an MKMapRect in points (i.e. 320x568 points for iPhone).
Is there something similar to converting co-ordinates to points? i.e.
[self.mapView convertCoordinate:coordinate1 toPointToView:self.view];

NMunro
- 1,282
- 4
- 18
- 33
6
votes
2 answers
How to determine the correct altitude for an MKMapCamera focusing on an MKPolygon
I need to figure out how to set up MKMapSnapshotterOptions to take a snapshot of aerial/satellite imagery associated with a polygonal region of the earth.
Filling out the 'region', 'scale', 'size', and 'mapType' properties are trivial, as I have an…

Daryll H.
- 523
- 4
- 10
5
votes
1 answer
Polyline drawMapRect optimized drawing
I have lots of long polylines on a map.
I'd like to optimize their drawing, because at a few thousand points the polylines are drawn incredibly slow.
My drawMapRect looks like this :
- for each polyline segment
- verify if it's bounding box…

Templar
- 1,694
- 1
- 14
- 32
4
votes
1 answer
How to convert CGRect to MapRect
I created a method as below to convert a CGRect to MapRect as below
- (MKMapRect)mapRectForRect:(CGRect)rect
{
CLLocationCoordinate2D topleft = [mapView convertPoint:CGPointMake(rect.origin.x, rect.origin.y) toCoordinateFromView:canvasView];
…

newme
- 331
- 1
- 5
- 11
4
votes
1 answer
Converting MKMapRect.origin to longitude and latitude
I have a need to annotate a visible point on a map(without user input). I am using MKMapView visibleMapRect to calculate the point I want. However from my codes below, I am reading values like
let rect = mapView.visibleMapRect
print(rect.origin.x)…

Ben Ong
- 913
- 1
- 10
- 25
3
votes
1 answer
How to offset properly an MKMapRect
I have to show an MKMapRoute on an MKMapView and it has to be shown in a specific region on my map, not in the center but in the top area.
It must be placed in a "frame" of about 80 points of height.
I thought I would be able to achieve this by…

dev_mush
- 2,136
- 3
- 22
- 38
3
votes
4 answers
MKMapRectMake how to zoom out after setup
I use MKMapRectMake to mark north east and south west to display a region. Here's how I do that:
routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y);
[self.mapView…

1110
- 7,829
- 55
- 176
- 334
3
votes
2 answers
Merge all MKMapRects to single MKPolygon
I want to draw corridor using MKPolygon over MKMap using Mapkit. I have one route from station A to B.
I have MKMapRects around route for drawing corridor. Now i want to merge all rectangles in single Polygon and that is my Corridor along with…

sagarcool89
- 1,366
- 8
- 16
2
votes
0 answers
How do I retain zoom level and visible region for an MKMapView during orientation change?
I am using MKMapView in one of my map. Let's say I zoom into see a region in portrait and after I change the orientation of the device, I want the map to show the same region before I do the rotation.
I have tried storing the Region and…

Ramaraj T
- 5,184
- 4
- 35
- 68
2
votes
1 answer
MKMapView setVisibleMapRect not working first time
I have implemented double tap to zoom using following code.
CLLocation* currentLocation = [myArray objectAtIndex:5];
MKMapPoint annotationPoint = MKMapPointForCoordinate(currentLocation.coordinate);
MKMapRect zoomRect =…

Steve Gear
- 757
- 2
- 16
- 44
2
votes
0 answers
SWIFT - MKMapRect rotation issue
I am trying to reposition my MKMapView to show to the currently selected annotation at the bottom of the view. The problem I run into is when the map has any rotation to it. It will only rotate back to default position, then stop and not move the…

the_pantless_coder
- 2,297
- 1
- 17
- 30
2
votes
2 answers
boundingMapRect for a circle
For an MKMapView overlay, I need to calculate the boundingMapRect for a circle. I have its center coordinate and radius (in meters) - but no idea how to get the corresponding boundingMapRect.
As workaround, I create a MKCircle with the same data…

Axel
- 1,716
- 1
- 16
- 28