Prix86
Prix86

Reputation: 21

Osmdroid scroll and zoom restriction

I'm working on a OpenStreetMap project with offline maps and it's working basically fine, but when the user scrolls or zooms out of the area that's support with offline maps he sees only gray area. How to set a limits for zoom in/out and the scroll area?

(There is a patch for MapView class in osmdroid but I can't make it work.)

Upvotes: 2

Views: 1065

Answers (1)

CjS
CjS

Reputation: 2047

The mMaximumZoomLevel and mMinimumZoomLevel variables defined in TileSourceFactory.java determine the zoom level limits. However, the defaults are definied correctly, and so unless you're using a custom tile source, or aren't using the factory to instantiate your tile source, it should work.

If you use your own constructor for a tile source, then max- and min-zoom levels are set in the constructor. E.g.

public XYTileSource(final String aName, final string aResourceId, final int aZoomMinLevel,
        final int aZoomMaxLevel, final int aTileSizePixels, final String aImageFilenameEnding,
        final String... aBaseUrl) {
    super(aName, aResourceId, aZoomMinLevel, aZoomMaxLevel, aTileSizePixels,
            aImageFilenameEnding, aBaseUrl);
}

Upvotes: 0

Related Questions