Mapkit - Overzoomed custom tiles not rendering when Polygons are present - ios

I'm providing an MKMapView with an MKTileOverlay that replaces the map content. The backing tile provider only goes up to zoom level 15. If the user zooms in beyond zoom level 15 it upscales the level 15 tiles on the map instead of going blank.
However, if there is an MKPolygon or MKPolyline present in the map sector, it will only display the shape. It will no longer render the backing tile under it. This only happens when you overzoom.
I've seen some discussiong about overzooming in MapKit but they all seem to be related to versions prior to iOS 7 when a large amount of the Maps appear to have been changed.
Does anyone have experience with this?

I realized that I was completely misinterpreting the functionality that MapKit provides for Map Tiles.
When I zoomed in and saw that my Tiles were rendering I assumed it was an overzoom feature. When the areas that had Polygons were not rendering the Map Tiles as these zoom levels I thought the Polygon Renderer was somehow shutting off the tile Renderer. As it turns out, because the only active renderer at that zoomed in level was the Polygon renderer that was the only part of the canvas being redrawn, so the rest of the canvas was just still showing what it already had on there.
In laymans' terms:
The Map Tile Renderer tells the map "I can draw this large area at zoom levels 0-5." The Polygon Renderer tells the map "I can draw this small area at all zoom levels."
When I'm at zoom level 5 both the Map Tile Renderer and the Polygon Renderer kick off and draw the regions they can handle. When I move into zoom level 6 only the Polygon Renderer kicks off. The map says "I have a renderer that can draw in this region so I'm going to redraw it with that information." Because the Map Tile Renderer doesn't provide tiles for zoom level 6 it won't kick off. The rest of the map still has tiles because there is no renderer that can draw for it, so the map just keeps what it already has on the canvas.
tl;dr: I mistook MapKit not making superfluous draw calls as an overzooming feature.

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.

MapBox Marker Size on Zoom (ios sdk)

I'm trying to change the size of the marker image during a zoom event, so the image scales nicely while pinching/zooming.
I can't find anywhere how to do this, the closest I have come is to resize the marker image after the zoom event is completed (when the zoom level changes)
It would look a lot nicer if it would resize during the zoom event instead of after.
Any ideas?
Look into using RMMapLayer directly (RMMarker's superclass) which should scale when zoomed. RMShape and RMCircle are also a good, albeit not directly related, models for this since they represent shapes that "stick" to the map instead of points that don't scale. But the short answer is there is not built-in functionality for this.

Draw a grid onto an MKMapView

I'd like to draw a grid into my map, that represents the size of a tile at a certain zoom level. So for example I'd like to have a grid on my mapview that shows the outline of a zoom level 10 tile. So the outline of where this tile would be. No matter if the mapview itself is at zoom level 5 or 15, it should display the outline of where that tile would be placed.
The problem I have is how to calculate the proper rect that represents each visible "tile".
Any help is sooo much appreciated!!!
Or maybe the answer to following question would help:
How can I convert a MKMapRect to a MKTileOverlayPath?
I find that MapKit is way too limited when you want to start doing more and more with maps.
I would reccomend using Google Maps SDK for iOS: https://developers.google.com/maps/documentation/ios/start
and then using GMSTileLayer for the tiles:
https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_tile_layer
In the long run, replacing MapKit with Google maps gives you far more features and options and has better geolocation and reverse geolocation than Apple
You can also look at Mapbox. Between using TileMill to create a grid layer by setting the Map background to a pattern image, you could then only export zoom level 10 and either host it on Mapbox or export it to MBTiles format (SQLite-based). Then one of the Mapbox mobile toolkits could serve the tiles out as an overlay on your map.

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]

iOS Maps - Grid Overlay

I'm looking for a way to overlay the iOS maps with a grid. The complete earth needs to be divided into squares. The location of the user doesn't effect the placement of the squares (In other words; the squares are always placed the same. On every iPhone, no matter where the user is).
I Looked into MKOverlay, but I've never used this so it's very new to me. Also, when zooming in/out should effect the overlay. It's very important that the squares are always covering the same area on the map (For example; A square should be 100mx100m in real world, when you zoom out, the square should cover the same 100x100).
Is there anybody that can point me in the right direction?
Is it possible to draw the grid from een .xml? Example given; On .XML is holding all squares with their coordinates on the map. When the user loads the map, the 100 squares around the user are loaded.

Resources