Osmdroid 5.6离线图块无法加载

时间:2017-10-31 09:15:28

标签: java android openstreetmap offline osmdroid

我在5.6.5版本中使用osmodroid地图,我想从MOBAC的osmdroid zip加载离线图块。
我创建了zip文件并将其放在sdcard/osmdroid/Mapnik.zip中。
我尝试加载离线图块,但它不起作用,地图是空的。我的代码出了什么问题?

    mMapView = (MapView) findViewById(R.id.mapview);
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mapController = (MapController) mMapView.getController();
    listener = new MyLocationListener(this, mapController, mMapView);
    mMapView.setUseDataConnection(false);

    mMapView.setTileSource(new XYTileSource("Mapnik", 2, 15, 256, ".jpg", new String[] {}));

    GeoPoint gPt = new GeoPoint(50, 50);
    mapController.setCenter(gPt);

    OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);

    mapController.setZoom(15);

在我的AndriodManifest.xml中,我有这些权限

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />

0 个答案:

没有答案