osmdroid - 更高的变焦水平? [英] osmdroid - higher zoom level?

查看:225
本文介绍了osmdroid - 更高的变焦水平?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用osmdroid库来实现一个图形页面。

I'm trying to implement a MapView using the osmdroid library.

不过目前最远的我似乎能够放大是不是我的目的,足以。

However at the moment the furthest I seem to be able to zoom in isn't sufficient enough for my purposes.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Setup map view:
    mapView = new MapView(this, 256);
    setContentView(mapView);

    // Parse parameters
    Intent intent = getIntent();

    center      = intent.getDoubleArrayExtra(INITIAL_CENTER);
    multiTouch  = intent.getBooleanExtra(MULTI_TOUCH, DEFAULT_MULTI_TOUCH);
    zoomButtons = intent.getBooleanExtra(ZOOM_BUTTONS, DEFAULT_ZOOM_BUTTONS);
    zoomLevel   = intent.getIntExtra(ZOOM_LEVEL, DEFAULT_ZOOM_LEVEL);

    if (center == null)
        center  = DEFAULT_INITIAL_CENTER;

    // Applying parameters
    mapView.setClickable(true);
    mapView.setMultiTouchControls(multiTouch);
    mapView.setBuiltInZoomControls(zoomButtons);
    mapView.getController().setZoom(zoomLevel);
    mapView.getController().setCenter(new GeoPoint(center[0], center[1]));
    mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
    mapView.setMaxZoomLevel(18);

    // Show current location coordinates
    Toast.makeText(
            getApplicationContext(),
            "Latitude:\t\t" + center[0] + "\n" +
            "Longitude:\t" + center[1],
            Toast.LENGTH_LONG).show();

    // Offline maps:
    mapView.setUseDataConnection(true);

}

反正是有进一步放大(我已经尝试过缩放级别设置为18)?

Is there anyway to zoom in further (I've already tried setting zoom level to 18)?

推荐答案

最大缩放级别由您正在使用的瓷砖源决定。如果正在使用的提供在线瓦片来源,如Mapnik的一个,那么最大缩放级别被设置为18,因为这是在瓷砖源创建瓷砖最大缩放级别。如果你想放大更多,那么你需要使用瓷砖源,可提供更高的变焦水平的瓷砖。

The maximum zoom level is determined by the tile source that you are using. If you are using one of the provided online tile sources like MAPNIK, then the max zoom level is set to 18 because that is the max zoom level that the tile source creates tiles for. If you want to zoom in further then you need to use a tile source that provides higher zoom level tiles.

如果您只是想无论砖源的缩放级别覆盖的最大缩放级别,那么你可以简单地调用:

If you simply want to override the max zoom level regardless of the tile source's zoom level then you can simply call:

mapView.setMaxZoomLevel(19);

到最大缩放级别设置为19,但同样瓦来源可能只是没有在那个缩放级别有地砖。

to set the max zoom level to 19, but again the tile source may just not have tiles at that zoom level.

这篇关于osmdroid - 更高的变焦水平?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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