Search code examples
swiftgoogle-maps-sdk-ios

Google Maps iOS SDK GMSURLTileLayer displaying incorrect color/transparency


PNG Tiles are showing incorrect color and transparency on iOS. Transparent areas show up as a semi-transparent white. The same tile set shows up correctly on Android and web browser, so I don't believe it is an issue is with the tiles themselves. Here's my Swift code:

class ViewController: UIViewController {
    @IBOutlet weak var mapView: GMSMapView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let camera = GMSCameraPosition.camera(withLatitude: 30.00, longitude: -90, zoom: 7.0)
        let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        view = mapView
                                
        // Implement GMSTileURLConstructor
        let urls: GMSTileURLConstructor = { (x, y, zoom) in
          let url = "https://aerocast.s3.amazonaws.com/radar/klix/lixtileskml/\(zoom)/\(x)/\(y).png"
          return URL(string: url)
        }

        let tilelayer = GMSURLTileLayer(urlConstructor: urls)
        
        tilelayer.zIndex = 100
        tilelayer.map = mapView
        tilelayer.opacity = 1.0
    
                  }
}

I've looked for some way to adjust the color properties of the tilelayer, but have not been able to find anything.


Solution

  • The issue was specific to the iOS emulator on xcode. The issue is not present on a physical iOS device. I brought up the problem to Google Maps support and they were able to replicate the problem and are looking into it.