问题
I have generated a sqlite
tile via atlas generator(according to this guide), but when i using this tiles in OSMDroid , OSMDroid does not showing anything!
I don't know what is the issue, i have checked everything like zoom levels, center locations and etc..
Here are my codes :
MapView map = (MapView) rootView.findViewById(R.id.map);
map.setTileSource(new XYTileSource(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "osmdroid" + File.separator + "tehran17.sqlite", 14, 17, 256, ".jpg", new String[] {}));
//....
map.setUseDataConnection(false);
IMapController mapController = map.getController();
mapController.setZoom(15);
GeoPoint startPoint = new GeoPoint(35.692855, 51.356535);
mapController.setCenter(startPoint);
I have checked needed permissions like read and write external, i have checked generated sqlite file and it seems it is OK.
回答1:
root cause: the Tile Source Name you're providing is the file path, not the actual name of the tile source. If you look at the database, each tile source is listed (assuming the osmdroid tile sqlite format) for each tile. I think the column name is "source" or "provider". That's the "name" of the XYZTileSource.
回答2:
I finally fixed the issue!
It is related to gradle, do not add OSMDROID from gradle, because it will not have access to external sd, download project source and add it as module to your app.
来源:https://stackoverflow.com/questions/34593047/osmdroid-does-not-show-map