Search code examples
iosswiftgoogle-mapsgoogle-maps-sdk-ios

Add layer above googlemaps layer in swift


I tried to add my own layer on google maps by code from google maps documentation:

extension MapViewController {
func addTiles() {
    // Implement GMSTileURLConstructor
    // Returns a Tile based on the x,y,zoom coordinates, and the requested floor
    let urls = { (x: UInt, y: UInt, zoom: UInt) -> NSURL in
        let url = "http://example.pl/ras/\(zoom)/\(x),\(y).v\(1).png";

        return NSURL(string: url)!
    }

    // Create the GMSTileLayer
    let layer = GMSURLTileLayer(URLConstructor: urls)
    layer.tileSize = 512
    layer.map = mapView
}}

I got smth like this:

enter image description here

I don't see terrain which should be under my tile. My tiles are transparent. Do you have any idea what can be wrong?

Update: Problem is occurring only on the iOS simulator. It is working on real devices.


Solution

  • Problem is occurring only on the iOS simulator. It is working on real devices.