奥斯德罗德.如何在地图视图中同时使用两个在线平铺源库



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

是的,这是可能的。为交通堵塞瓷砖创建一个新的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);

最新更新