OSMDroid 不显示地图 [英] OSMDroid does not show map

查看:72
本文介绍了OSMDroid 不显示地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过地图集生成器生成了一个 sqlite 磁贴(根据 this 指南),但是当我在 OSMDroid 中使用此磁贴时,OSMDroid 没有显示任何内容!我不知道是什么问题,我已经检查了缩放级别、中心位置等所有内容.

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..

这是我的代码:

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);

我已经检查了所需的权限,如外部读写,我已经检查了生成的 sqlite 文件,看起来没问题.

I have checked needed permissions like read and write external, i have checked generated sqlite file and it seems it is OK.

推荐答案

我终于解决了这个问题!
它与gradle有关,不要从gradle添加OSMDROID,因为它无法访问外部sd,下载项目源并将其作为模块添加到您的应用程序中.

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.

这篇关于OSMDroid 不显示地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆