Skip to content

Instantly share code, notes, and snippets.

@BastienClement
Created October 11, 2011 16:35
Show Gist options
  • Save BastienClement/1278620 to your computer and use it in GitHub Desktop.
Save BastienClement/1278620 to your computer and use it in GitHub Desktop.
GPS, format meters
function format_meters(m) {
if(m > 1000)
return (Math.round(m)/1000)+"km";
else if(m < 1)
return (Math.round(m*1000*1000)/1000)+"cm";
else
return (Math.round(m*1000)/1000)+"m";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment