Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Determine if Google Maps Tiles have Loaded

I am using the Google Maps API in my iOS application. At the end of a session the map zooms out and captures a screenshot. Unfortunately at the moment, often the map doesn't have time to load all the tiles exposed by the zoom before taking the screenshot.

I see that Apple's MKMapView has an mapViewDidFinishLoadingMap delegate. Is there something similar provided in the Google API?

like image 559
user3185748 Avatar asked Jan 29 '15 03:01

user3185748


People also ask

How do you check if Google Maps is loaded?

maps) {...} will give you a reference error if google is undefined (i.e. if the API didn't load). Instead, use if (typeof google === 'object' && typeof google. maps === 'object') {...} to check if it loaded successfully.

How many tiles are there in Google Maps?

Note that by dividing the pixel coordinates by the tile size (256) and taking the integer parts of the result, you produce as a by-product the tile coordinate at the current zoom level.

What is a map load?

A map load occurs whenever a Mapbox GL JS Map object is initialized on a webpage. This means that people who are using your web map can toggle additional sources on and off, interact with the map, and toggle between styles without affecting your usage.

How do places get added to Google Maps?

You can add important places by searching for locations or drawing them directly on the map.


1 Answers

The Google Maps SDK for iOS has a method called mapViewDidFinishTileRendering that is called when the map finishes rendering.

-(void)mapViewDidFinishTileRendering:(GMSMapView *)mapView{
    //TAKE THE SCREENSHOT HERE
}

Also, don't forget to set the delegate.

like image 65
themobileapper Avatar answered Nov 07 '22 11:11

themobileapper