IOS Google Maps Api Tiled Overlays

Currently my app uses google api v2 maps for iOS. I would like to add custom tile overlays, which, as I understand it, api does not support.

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

Then I tried to have my custom class extend UIView , and then add my class as a subview to the map view. I managed to use the GMSMapViewDelegate didChangeCameraPosition method to report camera news back to my custom class so that the tiles could be redrawn. This mainly worked with a few exceptions: first, only the initial set of tiles was loaded, and if you zoomed in or out from the initial X, Y, Z, then the map tiles will not be updated using the drawInRect method. The second problem was that my custom UIView covered all the markers and their respective callouts after clicking.

My question is: does anyone have experience adding custom fragments or subclassing the GMSOverlay class to add, for example, custom weather tiles on top of a google map?

+6
source share
2 answers

Good news from v. Release notes 1.3.0 SDK for Google Maps for iOS (released today):

Support for custom overlays (image-based) through GMSTileLayer.

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

+1
source

Have you tried looking at this example?

https://github.com/mtigas/iOS-MapLayerDemo

It is based on MKMapKit, not the Google-Map SDK. It supports zoom tiles and expands very easily and can point you in the right direction.

If you need to create tiles for a map, you can use MapTiler

http://www.maptiler.org/

The MapTiler version for Windows gives you finer control over tile generation.

0
source

Source: https://habr.com/ru/post/944252/


All Articles