我正在尝试使用自定义图块作为Google地图的叠加层。“https://tile.example.com/hot/{z} / {x} / {y} .png”我使用了“ GMSTileURLConstructor”,但无法在移动应用程序上加载地图。我似乎无法在网上找到任何东西。预先感谢。
我使用了以下几行。
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)
}
语法应为
let urls: GMSTileURLConstructor = {z,x,y in
let url = "https://tile.example.com/hot\(z)_\(x)_\(y).png"
print(url)
return URL(string: url)
}
根据Add a Tile Layer文档。