Android OSM droid - set Max Zoom level

前提是你 提交于 2019-11-30 05:17:35

问题


I am implementing App vith usage of osmdroid mapView. We have maps with max 16 zoom level, but Android allow us to have 18 zoom levels. Do you know how to set maximum zoom level 16 instead of default 18?

Thanks

Hmyzak


回答1:


Update - we have added simple setMin/MaxZoomLevel() methods to MapView in the trunk. It should be included in 3.0.10.

See https://code.google.com/p/osmdroid/issues/detail?id=418 for additional info.

Original answer:

Create your own TileSource class and use that. You can piggyback on one of the concrete tile source classes, like:

public static final OnlineTileSourceBase MyMapTileSource = new XYTileSource("My Tile Source",ResourceProxy.string.mapnik, 0, 16, 256, ".png", "");

Note the "16" - that is where you specify the max zoom level.

But really, you should create your own concrete class and extend BitmapTileSourceBase. It sounds like you are using static imagery and not online imagery which is what XYTileSource is for.




回答2:


You can use the mapView.setMinZoomLevel()and mapView.setMaxZoomLevel() methods to adjust the zoom level.



来源:https://stackoverflow.com/questions/6773480/android-osm-droid-set-max-zoom-level

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