iOS: Maximum Zoom while Setting a Region in MapKit? - ios

I'm trying to get my mapView to zoom in fairly close by using the setRegion function.
My problem is that, while testing, it seems that setRegion doesn't want to zoom in more than to a span of about 0.01 or so, even though I can manually pinch to zoom in closer than that.
What's stopping this? Will setRegion not allow me to zoom in closer?

Related

Prevent GMSMarkers from Scaling on iOS?

I am using GMSMarkers on iOS with the Google Maps API. I have a GMSMarker with a PNG image and no matter my zoom level on the map view the GMSMarker keeps its size respective to the screen. If I zoom in it is 30 points across the screen, and if I am zoomed all the way out on the map it is still 30 points. I do NOT want this to happen, I want the GMSMarker to stay small no matter what the zoom level is. It would be preferable that I do not have to loop through all my GMSMarkers every time the camera zoom changes, as I will be eventually having 50-100 of them on the map.
Is there anyway to keep the GMSMarker small no matter the zoom level on the GMSMapView?
I am using Objective-C, but if someone can only give me help in Swift or even Java I can still make do with that.
You could use a GMSGroundOverlay to add an image to the map which scales along with the map. So instead of a fixed size in pixels like a GMSMarker, it stays a fixed size in metres.
Note that another difference is that a ground overlay also stays oriented with the map, ie if the map is rotated/tilted, the top of the image rotates to point north, instead of staying pointing to the top of the screen like a marker.

Implementing zoom level for MKMapView

I'm trying to find an easier way to set and get a "zoom level" for an MKMapView than being changing its region's span, something more intuitive such as an integer zoom level... I need to programmatically change zoom and to frequently check the zoom level to determine if I should show or hide certain map overlays.
Thanks in advance.
You could use this category, it can get and set a zoomlevel : https://github.com/johndpope/MKMapViewZoom

Can a map overlay be moved?

I'm displaying several user's locations on a map simultaneously as circles of different colors.
I can do this using an annotation and then when the user's location updates use UIView:animateWithDuration: to move to their new location.
However there is a requirement that the size of the circles reflects the accuracy of the location i.e. very accurate equals a circle of size 10 meters, rough accuracy is represented as a circle of size 500 meters etc.
However there are two problems using annotations for this - the first is how to transform meters into a CGRect on the correct size to draw on the map. And the second is the annotations need to be resized if the user zooms the map.
So I was looking at using an overlay instead as that already has a radius and automatic resizing during zooming built in so it handles those two problems.
However it looks like overlays are meant to be static and their coordinate property is read only.
Is there some way I can make the overlays move as the user's location moves? (other than completely remove it and re-add it?)
[THis is for iOS 7 only]

MKMapView - Is there a way to use MKUserTrackingModeFollow with a modified center/focus?

I have a MapView that takes up the full screen and a few elements toward the top of the screen that overlay the map. These top elements potentially cover the blue location marker.
The map is currently tracking fine with MKUserTrackingModeFollow, but I'd like to move the tracking focus down about an inch (obviously the metric will vary by zoom level) to ensure the marker isn't covered. Is there a way to do this with MKUserTrackingModeFollow?
I've considered moving the map with the top elements, but due to design constraints this isn't an option.
Instead of using the userTrackingMode of the MKMapView object to follow the user's location, you could set up a delegate of CLLocationManager to receive location tracking events, and with each location update event you receive, set the center coordinate of the map view, with your vertical offset added to the coordinate value.
You can use the various Map Kit functions and MKMapView methods to convert your offset from some fraction of the map view's bounds.height to a MKMapPoint or CLLocationDistance value.

Is there any way to programatically zoom MKMapView without it snapping to one of its predefined zoom levels?

I am using setRegion to have MKMapView zoom in to the region I have supplied. The problem is that there is very little granularity to this and it simply chooses the most proximate zoom-level and zooms to that.
Is there any way of having it zoom to exactly the region I have supplied or do I need to accept this limitation and move on?
No, currently it zooms so that the map tiles aren't blurry, which means fixed zoom levels. The upcoming update seems to render on the fly, so you may be able to do it in the future, but for now you'll have to accept the region you get.

Resources