Skip to content

edorsey/tude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tude

This is a simple module that allows you to encode and decode latitude and longitude coordinates for use in URLs while keeping the space the information occupies to a minimum. This is useful if you are wanting to pass GPS coordinates in a URL and keep the link as short as possible (for example, SMS or Twitter).

API

encode(lat, lng, [precision=6])

var tude = require('tude');

tude.encode(39.092765, -94.584045); //62E1Ot-6oRD7

The first character represents the precision of the encoding. This is basically how many decimal places to keep intact. A smaller precision will result in a shorter string. precision defaults to 6.

decode(encodedLatLng)

var tude = require('tude');

tude.decode("62E1Ot-6oRD7"); //{ lat: 39.092765, lng: -94.584045 }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published