我正在玩Osmdroid API,我可以看到基本地图。但是当我尝试设置自定义磁贴源时 - 我为每个磁贴完全掌握了404 HTTP错误。我已经在桌面浏览器中检查了我的磁贴请求,它可以正常工作,返回正确的磁贴。我想,osm库在构建http请求时出错了。我的问题是 - 我如何记录http请求,osm为瓷砖做?大多数代理解决方案适用于移动浏览器而非应用。 osm api上有一些日志工具吗?
以下是代码:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView map = (MapView) findViewById(R.id.map);
ITileSource tileSource = new XYTileSource("KGKMap", 3, 18, 256, ".png", new String[]{"http://map2.kgk-global.com/tiles/tile.py"});
map.setTileSource(tileSource);
map.setBuiltInZoomControls(true);
}
}
我得到了什么:
01-21 04:27:40.306 25696-25737/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/0/1 HTTP response: Not Found
01-21 04:27:40.306 25696-25746/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/2/2 HTTP response: Not Found
01-21 04:27:40.321 25696-25737/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/5/5 HTTP response: Not Found
01-21 04:27:40.325 25696-25746/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/7/1 HTTP response: Not Found
01-21 04:27:40.335 25696-25737/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/6/1 HTTP response: Not Found
01-21 04:27:40.338 25696-25746/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/4/1 HTTP response: Not Found
01-21 04:27:40.357 25696-25737/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/3/1 HTTP response: Not Found
01-21 04:27:40.357 25696-25746/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/2/1 HTTP response: Not Found
01-21 04:27:40.369 25696-25737/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/6/2 HTTP response: Not Found
01-21 04:27:40.373 25696-25746/kravtsov.evgeny.openstreetmap W/OsmDroid: Problem downloading MapTile: /3/4/5 HTTP response: Not Found
答案 0 :(得分:0)
问题解决了。由OSM生成的Http查询与我的磁贴服务器协议不匹配。解决方案很简单 - 从OSM扩展XYTileSource类。在getTileURLString()方法中,您可以为http查询创建任何表单。