Mark Berner
Mark Berner

Reputation: 129

MKMapView show extra zoomed region. How?

I need to show very small area (30x30 meters) on MKMapView. Setting appropriate region or visibleMapRect doesn't work. MapView shows much bigger region.

MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([centerLocation coordinate], 30, 30); 
[mapView setRegion:region];

It seems with extra small regions MapView corrects with regionThatFits method before update map.

Manually zoom allows displaying such region.

Upvotes: 3

Views: 428

Answers (2)

incanus
incanus

Reputation: 5128

MapKit is not really designed for such high-zoom indoor uses. You may want to check out alternatives such as the open source MapBox iOS SDK, which has been used for indoor applications. In particular iOS 7's iBeacons technology as well may be useful to you for indoor triangulation and higher accuracy than something like GPS, which was neither designed for indoor nor high-zoom use.

Upvotes: 1

Apurv
Apurv

Reputation: 17186

According to Apple docs:

When setting a new region, the map may adjust the value in the region parameter so that it fits the visible area of the map precisely. This is normal and is done to ensure that the value in the region property always reflects the visible portion of the map. However, it does mean that if you get the value of that property right after calling this method, the returned value may not match the value you set. (You can use the regionThatFits: method to determine the region that will actually be set by the map.)

So, when you apply distance, it creates the region which is best fit for your request. It will not be exactly same as what you have requested.

Also, 30*30 meters is very very high zoom level which might not be supported. Hope it will help.

Upvotes: 0

Related Questions