Phi*_*hil 8 android google-maps google-maps-android-api-2
Google地图提供了几个月的功能,可以下载某个地理区域供以后离线使用.我在我的应用程序中使用谷歌地图Android API,我发现在离线时,与真正的谷歌地图应用程序相比,我无法完全放大我的应用程序中的街道级别,因此可能不会使用下载的数据.
有没有办法让我的应用程序使用它?
您需要在TileProvider本地创建自己的和访问磁贴.查看此文档.
以下是一些可能对您有帮助的相关主题:
你也可以使用osmdroid来代替Android的MapView类.它还包括一个模块化磁贴提供程序系统,支持众多在线和离线磁贴源以及内置叠加层的叠加支持,用于绘制图标,跟踪位置和绘图形状.这是教程.
org.osmdroid.views.MapView mapView = (org.osmdroid.views.MapView) findViewById(R.id.map_view); //resolve the map view by id given in the layout
mapView.setTileSource(new OnlineTileSourceBase("Google Maps", ResourceProxy.string.unknown, 1, 20, 256, ".png", "http://mt3.google.com/vt/v=w2.97") {
@Override
public String getTileURLString(final MapTile aTile) {
/*
* GOOGLE MAPS URL looks like
* base url const x y zoom
* http://mt3.google.com/vt/v=w2.97&x=74327&y=50500&z=17
*/
return getBaseUrl() + "&x=" + aTile.getX() + "&y=" + aTile.getY() + "&z=" + aTile.getZoomLevel();
}
});
mapView.setUseDataConnection(false); //this actually makes the controller use only offline tiles
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
8018 次 |
| 最近记录: |