0.2.0 • Published 4 years ago

bigdatacloud-reverse-geocoding v0.2.0

Weekly downloads
9
License
GPL-3.0
Repository
github
Last release
4 years ago

bigdatacloud-reverse-geocoding

Reverse geocoding browser-based typescript library, using free Bigdatacloud API

Features

  • Connects with Bigdatacloud.com and using reverse geocode API for acquiring the location info.
  • Using promises (no callback hell anymore)

Installation

$npm i -S bigdatacloud-reverse-geocoding

or

$yarn add bigdatacloud-reverse-geocoding

Usage (very clear and simple)

import ReverseGeocode, { ILocation, IGeocode } from "bigdatacloud-reverse-geocoding";
const geocode = new ReverseGeocode();
const location: ILocation = { lat: 33.23323, long: -76.33443};
const place: IGeocode = await geocode.locate(location);
console.log(place.locality);

Optional initialization

You can use options. There are four parameters:

NameDefault valueDescription
languageenThe language of the Bigdatacloud answer. This is the only parameter that you would normally use. new ReverseGeocode({language:"cn"})
apihttps://api.bigdatacloud.netThe API host
endpoint/data/reverse-geocode-clientThe API endpoint
formatlatitude=${lat}&longitude=${long}&localityLanguage=${lang}The query string with placeholders

Links

Bigdatacloud API