A plugin for Leaflet that provides custom and nautical scale controls

meteor add appshore:leaflet-customscale@=0.0.3


leaflet.customscale plugin packaged for Meteor

Forked from


var scale = new L.Control.ScaleNautic({
    metric: true,
    imperial: false,
    nautic: true

var custom = new L.Control.ScaleCustom({
    metric: true,
    imperial: true,
    // Custom scale in nautical miles
    custom: function(maxMeters, leafletDefaultRoundingFunction) {
        var maxNauticalMiles = maxMeters / 1852,
        if(maxMeters >= 1852) {
            nauticalMiles = leafletDefaultRoundingFunction(maxNauticalMiles);
        } else {
            nauticalMiles = maxNauticalMiles > 0.1 ? Math.round(maxNauticalMiles * 10) / 10 :                                  Math.round(maxNauticalMiles * 100) / 100;
        return {
            caption: nauticalMiles + ' nm',
            ratio: nauticalMiles / maxNauticalMiles

Leaflet scale control in nautic miles (and / or custom units)

Extends the default leaflet scale control (introduced with 0.4), implementing

  • a scale control displaying the scale in nautical miles
  • a scale control which (by means of a simple callback function) allows you to implement whatever unit you wish

Both extensions are independent from each other, so you only need to include the one you want. See the example HTML files for a simple demo on how to use them.

Actual demos to play with can be found here for nautic scale and here for custom scale (which, in the demo, also implements scale in nautical miles).