Search code examples
iosgoogle-maps-sdk-ios

iOS Google Maps Api Tiled Overlays


My app currently is using the google maps api v2 for iOS. I would like to add custom tiled overlays, which I realize is not support by the api.

The first approach I took to this problem was to try to extend the GMSOverlay class but I later found that the drawLayer method was never being called.

Next, I tried having my custom class extend UIView and then add my class as a subview to the map view. I was able to use the GMSMapViewDelegate method didChangeCameraPosition to report camera updates back to my custom class so that the tiles could be redrawn. This mostly worked with a couple exceptions, first, only the initial set of tiles would load, and if you panned or zoomed from the initial X,Y,Z the map tiles would not update via the drawInRect method. The second problem was that my custom UIView was covering all the markers and their corresponding callouts after tapping.

My question is, does anyone having any experience adding custom tiles or subclassing the GMSOverlay class to add, for example, custom weather tiles over top of the google map?


Solution

  • Good news from the release notes of v. 1.3.0 of Google Maps SDK for iOS (released today):

    Support for custom tile overlays (image-based) via GMSTileLayer.

    See: https://developers.google.com/maps/documentation/ios/releases