【问题标题】:Osmdroid. How to use two online tile source base the same time in mapviewOsmdroid。如何在mapview中同时使用两个在线瓦片源库
【发布时间】:2015-04-02 05:32:25
【问题描述】:

对不起,我的英语不好。我有问题。是否可以在地图视图中同时使用两个或多个在线资源库?例如,我有两个在线资源库,一个是这个地图图块,另一个显示道路上的交通拥堵。两个图块均为 256x256 像素 jpg 格式。我想在地图图块上方显示交通拥堵图块。有可能吗?

【问题讨论】:

    标签: dictionary osmdroid


    【解决方案1】:

    是的,这是可能的。为您的交通拥堵图块创建一个新的TilesOverlay,并将其添加到地图的叠加层列表中。

    查看 OpenStreetMapViewer 示例中的 SampleWithTilesOverlayAndCustomTileSource.java:

    final MapView osmv = new MapView(this, 256);
    
    // …
    
    // Add tiles layer with custom tile source
    final MapTileProviderBasic tileProvider = 
            new MapTileProviderBasic(getApplicationContext());
    final ITileSource tileSource =
            new XYTileSource("FietsRegionaal", null, 3, 18, 256, ".png",
            new String [] {"http://overlay.openstreetmap.nl/openfietskaart-rcn/"});
    tileProvider.setTileSource(tileSource);
    final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider,
            this.getBaseContext());
    tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
    
    osmv.getOverlays().add(tilesOverlay);
    

    【讨论】:

    • 感谢 Bruno Parmentier! :)
    猜你喜欢
    • 2020-08-04
    • 1970-01-01
    • 2012-11-29
    • 1970-01-01
    • 2014-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-02
    相关资源
    最近更新 更多