Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art

Using a Scale on an OpenStreetMap Map

In Chapter: Location and Map Applications
Author: Rachee Singh ('racheesingh')
Published? true
FormatLanguage: WikiFormat


You need to show a map scale on your OSM to indicate the level of zoom on the MapView


A scale can be added on the OSM as an overlay using the ScaleBarOverlay class


Putting a scale on your MapView helps the user keep track of the zoom level at which he is (also helping him/her of the approximate distances on the map). To overlay a scale on your OSM MapView, instantiate the ScaleBarOverlay and add it to your MapView using the add method.

Here is how the code would look:

ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(this);

The scale bar overlay looks like this: