我正在尝试使用自定义图块作为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文档。
关于ios - 无法使用iOS Swift在Google map 上加载自定义图 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58606218/