java-osmdroid上的多个平铺层

java-osmdroid上的多个平铺层,第1张

概述目前,我正在OSMdroid底图上加载一个图块数据层,finalMapTileProviderBasictileProvider=newMapTileProviderBasic(getApplicationContext());finalITileSourcetileSource=newXYTileSource("MyCustomTiles",null,1,16,256,".png",

目前,我正在OSMdroID底图上加载一个图块数据层,

final MapTileProvIDerBasic tileProvIDer =     new MapTileProvIDerBasic(getApplicationContext());final ITileSource tileSource =     new XYTileSource("MyCustomTiles", null, 1, 16, 256, ".png",            "http://a.url.to/custom-tiles/");tileProvIDer.setTileSource(tileSource);final TilesOverlay tilesOverlay =     new TilesOverlay(tileProvIDer, this.getBaseContext());tilesOverlay.setLoadingBackgroundcolor(color.transparent);osmv.getoverlays().add(tilesOverlay);

是否可以在BaseMap上彼此叠加渲染多个数据层,或者我一次只能显示一个数据层?
我找到了this example for GoogleMaps,但没有找到一些示例OSMdroID代码,一次处理多片tileSource.

解决方法:

是的,当然可以.您只需向地图添加另一个TilesOverlay.从列表的最低索引(= 0)开始,连续绘制覆盖图(也称为tileOverlays).
这是一个例子:

//create the first tilesOverlayfinal MapTileProvIDerBasic tileProvIDer = new MapTileProvIDerBasic(getApplicationContext());final ITileSource tileSource = new XYTileSource("MyCustomTiles", null, 1, 16, 256, ".png",        "http://a.url.to/custom-tiles/");tileProvIDer.setTileSource(tileSource);final TilesOverlay tilesOverlay = new TilesOverlay(tileProvIDer, this.getBaseContext());tilesOverlay.setLoadingBackgroundcolor(color.transparent);//create the second onefinal MapTileProvIDerBasic anotherTileProvIDer = new MapTileProvIDerBasic(getApplicationContext());final ITileSource anotherTileSource = new XYTileSource("MyCustomTiles", null, 1, 16, 256, ".png",        "http://a.secondurl.to/custom-tiles/");anotherTileProvIDer.setTileSource(anotherTileSource);final TilesOverlay secondTilesOverlay = new TilesOverlay(anotherTileProvIDer, this.getBaseContext());secondTilesOverlay.setLoadingBackgroundcolor(color.transparent);// add the first tilesOverlay to the Listosmv.getoverlays().add(tilesOverlay);// add the second tilesOverlay to the Listosmv.getoverlays().add(secondTilesOverlay);
总结

以上是内存溢出为你收集整理的java-osmdroid上的多个平铺层全部内容,希望文章能够帮你解决java-osmdroid上的多个平铺层所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1086173.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存