@etomon/etomon-location

Client/Server library for querying locations

Usage no npm install needed!

<script type="module">
  import etomonEtomonLocation from 'https://cdn.skypack.dev/@etomon/etomon-location';
</script>

README

Etomon Location

Etomon Location provides a client/server for getting location information (like country code, or timezone) given inputs like coordinates (lat/lng), a keyword (like "New York City"), or an IP Address.

The project provides the address resolver (api/server/GeoResolver) along with express routes (api/server/routes) that expose both a REST interface, and a JSON RPC interface to interact with the library remotely.

A client implementation is also provided (api/client/GeoClient) that runs in the browser.

Requirements

This library has two external dependencies

  • Access to the Google Places, Geocoding, Timezone and Autocomplete APIs. This service is not free.
  • The Maxmind GeoIP City database, which is available for free with registration.

The Places API is needed to make sense of addresses and coordinates, the Geocoding API for timezone data, the Autocomplete API for places autocomplete, and GeoIP to get location data from IP addresses.

Caching

An instance of LevelUp can be passed into the GeoResolver constructor to cache results. This practice is disallowed by the Google Places API Terms of Service. The functionality is included for testing purposes only, using it in production violates the Google Places API Terms of Service.

Documentation

Documentation can be generated by running npm run docs and opening docs/index.html or by visiting the GitHub pages for this project.

Testing

Tests are written in mocha, run with npm test.

You'll need to set the GOOGLE_API_KEY and GEO_IP_CITY_PATH env variables with the resources described above.

License

This project is licensed under the GNU LGPL-3.0 a copy of which can be found in LICENSE.txt.