我正在使用osmdroid库在我的应用程序中具有osm映射功能。
compile 'org.osmdroid:osmdroid-android:6.0.2'
所有功能都可以正常工作,但是我有一个与地图外观有关的问题。网站也正在开发,具有与该应用程序相同的功能,并且在网络上它们也使用osm映射。 现在的问题是,地图在网站上看起来非常清晰,而在android设备上看起来却很模糊。
查看随附的屏幕截图
移动屏幕截图
网络屏幕截图
下面是我在Android应用中加载地图的代码。
binding.map.setTileSource(TileSourceFactory.MAPNIK);
binding.map.setTilesScaledToDpi(true);
binding.map.setBuiltInZoomControls(false);
binding.map.setMultiTouchControls(true);
if (gpsTracker.canGetLocation()) {
if (gpsTracker.getLocation() != null) {
currentLocation = gpsTracker.getLocation();
centreLocation = gpsTracker.getLocation();
addCurrentLocationMarker(currentLocation);
getMarkersInCurrentLocation(currentLocation);
} else {
gpsTracker.showSettingsAlert();
}
} else {
gpsTracker.showSettingsAlert();
//Toast.makeText(getApplicationContext(), "Unable to get current location", Toast.LENGTH_LONG).show();
}
这与我正在使用的图块源有关吗?
答案 0 :(得分:3)
这是由于binding.map.setTilesScaledToDpi(true)会根据您的设备分辨率缩放图块。 试试看:图像会干净,但是标签应该太小,可读性较差。
AFAIK,尚无好的解决方案:OpenStreetMap切片在当前移动设备的分辨率下不可用。
-编辑12/12/2018- 参见https://github.com/osmdroid/osmdroid/issues/1217