No map displayed when using bounding box; setScrollableAreaLimitDouble

人走茶凉 提交于 2019-12-14 03:58:21

问题


Been wanting to display just one section of the world map. Made mbtiles for it as well. But I also want the user to not be able to move outside a limited area. Below is the code I ran using Bounding Box on the world map but nothing is displayed on the screen, both on an emulator and an actual android device. Please help.

    IMapController mapController = mapView.getController();
    BoundingBox bounds = mapView.getBoundingBox();

    mapView.setTileSource(TileSourceFactory.MAPNIK);
    mapView.setUseDataConnection(false);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);

    mapController.setZoom(10.0);
    mapView.setMinZoomLevel(10.0);

    mapController.setCenter(new GeoPoint(51.459569,-0.167153));

    //compass
    CompassOverlay mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mapView);
    mCompassOverlay.enableCompass();
    mapView.getOverlays().add(mCompassOverlay);

    //scale
    ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(mapView);
    mScaleBarOverlay.setCentred(true);
    mScaleBarOverlay.setScaleBarOffset(500, 50);
    mapView.getOverlays().add(mScaleBarOverlay);


    mapView.setScrollableAreaLimitDouble(bounds);

来源:https://stackoverflow.com/questions/51529648/no-map-displayed-when-using-bounding-box-setscrollablearealimitdouble

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!