Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Google Maps equivalent to mkmapsnapshotter?

I have a UITableView which may potentially contain a large number of cells, and in some cells I want a UIImageView showing a map of a location, the coordinates of which are known only at runtime.

I want the table view to scroll smoothly and I want the maps in the cells to not be scrollable at all.

I've been directed to avoid Apple Maps. Besides, MKMapSnapshotter is iOS 7 and up. I have to support iOS 6.

So is Google Maps image API my best option?

I'm already using the Google Maps iOS SDK anyway, so I'd like to use it for this if possible. But does it have this feature? An equivalent to MKMapSnapshotter? I'm surprised I can't find it in the documentation.

like image 886
Sterling Christensen Avatar asked Oct 08 '14 21:10

Sterling Christensen


1 Answers

There used to be a GMSScreenshot class in the SDK, that could be used to take screenshots. However in v1.2 Google removed this, as you could use renderInContext instead. You can see some background info and sample code here:

Google Maps IOS SDK 1.2 need snapshot of map view

Issue taking screen capture of GMSMapView on Google Maps SDK for iOS

https://developers.google.com/maps/documentation/ios/releases#version_12_-_april_2013

I think though that renderInContext (and GMSScreenshot before it) is designed for taking a screenshot of a map view that is already on a view, has been displayed for a while, has downloaded map tiles etc. I'm not sure that it would work well if you created a map view in the background, set the camera position to your desired lat/lon, rendered it to an image, and then repeated for the other locations you want.

So, I suspect that the Google Maps image API would work better for what you are doing.

like image 63
Saxon Druce Avatar answered Oct 21 '22 08:10

Saxon Druce