Osmdroid and Mapnik tile provider no longer working

南笙酒味 提交于 2019-11-28 00:14:29

Please follow Issue 515 to track this issue. We have implemented a fix and we will release a proper update soon.

Having the same problem as well.

Unfortunately, it seems that osmdroid was banned from accessing http://tile.openstreetmap.org. Reading the tile usage policy, I found these two things which might explain why osmdroid got banned:

Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators.

and

Valid User-Agent identifying application. Faking another app's User-Agent WILL get you blocked.

(osmdroid's useragent is "Apache-HttpClient/UNAVAILABLE (java 1.4)" which is pretty generic)

From OpenPisteMap:

If you start getting "403 Forbidden" responses, stop. Don't just keep hammering away at the server - it probably means that you've been banned for abusive behaviour and continuing to hammer away at the server will just extend your ban.

http://wiki.osm.org/wiki/Blocked

You can use this code to set the user agent

        HttpClientFactory.setFactoryInstance(new IHttpClientFactory() {
        public HttpClient createHttpClient() {
            final DefaultHttpClient client = new DefaultHttpClient();
            client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "useragent");
            return client;
        }
    });
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!