geolocation-latlng

ES6 class to work with and format Geolocation API latitude and longitude

Usage no npm install needed!

<script type="module">
  import geolocationLatlng from 'https://cdn.skypack.dev/geolocation-latlng';
</script>

README

geolocation-latlng

ES6 class to work with Geolocation API latitude and longitude

Installation

# NPM
npm install geolocation-latlng --save

# Yarn
yarn add geolocation-latlng

Getting Started

import { LatLng } from 'geolocation-latlng';

// Create an instance
let latLng = new LatLng(latitude, longitude);

// Pretty string methods available**
latlng.latitude.toString();
latLng.longitude.toString();

// Get distance to another coordinate
latLng.getDistanceTo(lat, lng);

** Latitude and longitude are instance of the Coordinate class. Many formatting and utility methods are available on latitude and longitude.

Credits

The LatLng API was inspired by the Google Maps API as well as MapBox's API.

License

MIT License Copyright (c) 2018 Joel Colucci