对不起,我是刚开始Android开发的。想知道是否有使用OSMdroid加载开放循环地图的方法?从网站上看,似乎没有简单的方法可以做到:https://github.com/osmdroid/osmdroid/wiki/Map-Sources
因此,有谁能给我一些建议,如何做到这一点?
我认为唯一的方法是手动定义Tile Source,如下所示。想知道有什么更简单的方法吗?
final String[] tileURLs = {"http://a.tile.thunderforest.com/cycle/",
"http://b.tile.thunderforest.com/cycle/",
"http://c.tile.thunderforest.com/cycle/"};
final ITileSource OCM =
new XYTileSource("Open Cycle Map",
0,
19,
512,
".png",
tileUrls,
"from open cycle map");非常感谢
发布于 2018-09-29 16:03:01
定义瓷砖源是一种正确的方法。这是一个非常好的方法,许多内置的瓷砖源都是在同样的方式中定义的。
但是,根据http://thunderforest.com/maps/opencyclemap/的文档,您应该获得并使用API键:
想用这些瓷砖吗?OpenCycleMap层的通用平铺格式字符串是:
https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=<insert-your-apikey-here>
因此,您应该包含API键:
final ITileSource OCM =
new XYTileSource("Open Cycle Map",
0,
19,
512,
".png?apikey=<insert-your-apikey-here>",
tileUrls,
"from open cycle map");(这只是问题中修改过的代码。我没有测试它,因此有些参数不一定是正确的)
https://stackoverflow.com/questions/52566017
复制相似问题