No map displayed when using bounding box; setScrol

2019-07-31 14:24发布

问题:

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);