lonlng
Lat/lon normalization cause...sigh.
No one has agreed on a standard way of representing lat/lon. This is a small normalization library. Use this to convert all outside input before processing internally and convert to an external format right when it's being output.
{lon: ${longitude}, lat: ${latitude}}
representation
Just use the Utilizing this won't always be possible/easiest, so please at least adopt the following conventions. Any variables or functions that contain the following names should be represented by the accompanying structure:
latlon
:{lon: ${longitude}, lat: ${latitude}}
coordinates
:[${longitude}, ${latitude}]
point
:{x: ${longitude}, y: ${latitude}}
If you must convert it to a string, put it in the following format:
'${longitude},${latitude}'
API
const lat = 3813234const lon = 7001232const latlon = lat lonconst point = x: lon y: latconst coordinates = lon latconst str = `,` const pairs = // normalization latlon latlon latlon latlon // convert to type, normalizes to `latlng` first in each function ll coordinates ll point ll str // if the type is known, use the specific convert function directly latlon ll latlon ll latlon ll latlon ll pairs