OSM IO异常下载MapTile

时间:2012-03-06 08:37:39

标签: android osmdroid openstreetmap

我正在使用omdroid 3.0.8测试一个非常简单的OSM应用程序(并在实际的HTC Desire设备上进行测试)。 多数民众赞成我想做的事情:

final org.osmdroid.views.MapView mapView = new org.osmdroid.views.MapView(this, 256);                          
setContentView(mapView);                          
mMapView = mapView;                            
final org.osmdroid.views.overlay.MyLocationOverlay mlo = new org.osmdroid.views.overlay.MyLocationOverlay(this, mapView);                          
mapView.getOverlays().add(mlo);                          
mMyLocationOverlay = mlo;
mMapView.getController().setZoom(14);                  
mMapView.getController().setCenter(new GeoPoint(52370816, 9735936));                 
mMyLocationOverlay.disableMyLocation();

尝试获取OSM MapView我只获得一个网格,并在LogCat中“IO Exception下载MapTile”:

03-06 14:22:43.444: D/dalvikvm(901): GC_FOR_MALLOC freed 1896 objects / 766304 bytes in 61ms
03-06 14:23:09.194: W/System.err(901): 310899 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5384 : java.net.SocketException: The operation timed out
03-06 14:23:11.664: D/dalvikvm(901): GC_FOR_MALLOC freed 3009 objects / 1169544 bytes in 66ms
03-06 14:23:19.974: W/System.err(901): 321679 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5385 : java.net.SocketException: The operation timed out
03-06 14:23:34.084: W/System.err(901): 335789 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5384 : java.net.SocketException: The operation timed out
03-06 14:23:40.984: W/System.err(901): 342689 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8635/5385 : java.net.SocketException: The operation timed out
03-06 14:23:55.094: W/System.err(901): 356798 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8633/5381 : java.net.SocketException: The operation timed out

......等等。设备上的网络连接是可以的,而且,使用相同地图的OsmAnd应用没有任何问题。 我需要在线获取地图,这就是重点。如何从我的应用程序中获取OSM地图?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。它与sdcard上的权限 - OSM下载磁贴相关联,因此需要WRITE_EXTERNAL_STORAGE权限。