0

I'm trying to use custom tiles as overlay for google maps. "https://tile.example.com/hot/{z}/{x}/{y}.png" I used "GMSTileURLConstructor", but unable to load map on mobile app. I cannot seem to find anything online. Thanks in advance.

I used the following lines.

class ViewController: UIViewController, GMSMapViewDelegate{

    let urls: GMSTileURLConstructor = {z,x,y in
       let url = "https://tile.example.com/hot/{z}/{x}/{y}.png"
       print(url)
       return URL(string: url)
   }
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
LakshAnu
  • 9
  • 2
  • 1
    where you tried this `iOS simulator` or `device` – Anbu.Karthik Oct 29 '19 at 11:09
  • ""https://tile.example.com/hot/{z}/{x}/{y}.png" That's not a valid URL. `url` isn't nil, but `URL(string: url)` is. You need to percent escape "{" "}" I guess? Or at least put the values, right not it's hard coded "z". – Larme Oct 29 '19 at 11:47
  • I tried in device. – LakshAnu Oct 29 '19 at 12:04
  • Now I'm getting like this, but the app is not displaying the map. https://tile.example.com/hot/{3}/{6}/{3}.png https://tile.example.com/hot/{3}/{7}/{2}.png https://tile.example.com/hot/{3}/{7}/{3}.png https://tile.example.com/hot/{3}/{6}/{4}.png https://tile.example.com/hot/{3}/{6}/{5}.png https://tile.example.com/hot/{3}/{7}/{4}.png – LakshAnu Oct 29 '19 at 12:13
  • `URL(string: url)` is nil. Copy/paste that URL in Safari, you'll see. Also, as you can see, SO doesn't even consider the "{3}/{7}/{2}.png" as part of the URL. Don't you think that's a good lead to make it at least working in Safari? – Larme Oct 29 '19 at 13:21
  • Is this issue solved? – LuisTavares Nov 23 '19 at 08:37

0 Answers0