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 MapBack to Android Cookbook Home | Up to Chapter: Location and Map Applications

Author: Rachee Singh ('racheesingh')
In Published Edition? Yes
FormatLanguage: WikiFormat

Using a Scale on an OpenStreetMap Map


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:

See Also