npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bigdatacloud-reverse-geocode-client

v2.0.0

Published

Free client-side reverse geocoding — GPS to city/country with automatic IP fallback. No API key needed.

Readme

BigDataCloud Free Reverse Geocoding JavaScript Client

License: MIT

Description

A lightweight, zero-dependency JavaScript client for BigDataCloud's free reverse geocoding API. Convert GPS coordinates to city, country and locality information — right in the browser, with no API key required.

How it works:

  1. Requests the user's GPS position via the browser Geolocation API
  2. If GPS is available and permitted, reverse geocodes the coordinates
  3. If GPS is denied or unavailable, automatically falls back to IP-based geolocation

No sign-up, no API key, no server required for basic use.


Quick Start (Modern — ES Module)

import BDCReverseGeocode from './bigdatacloud_reverse_geocode.mjs';

const geo = new BDCReverseGeocode();

// Promise-based: GPS first, IP fallback automatic
const location = await geo.detect();
console.log(location.city, location.countryName);

With async/await error handling

import BDCReverseGeocode from './bigdatacloud_reverse_geocode.mjs';

const geo = new BDCReverseGeocode();

try {
  const location = await geo.detect();
  console.log(`You are in ${location.city}, ${location.countryName}`);
} catch (err) {
  console.error('Could not determine location', err);
}

Reverse geocode known coordinates

console.log(location.city); // "Sydney"

Quick Start (Script Tag — Legacy)

For pages that don't use ES modules, include the legacy script:

<script src="bigdatacloud_reverse_geocode.js"></script>
<script>
  var geo = new BDCReverseGeocode();

  // GPS first, IP fallback
  geo.getClientLocation(function(location) {
    if (!location) {
      console.error('Could not determine location');
      return;
    }
    console.log(location.city, location.countryName);
  });
</script>

API Reference

Constructor

new BDCReverseGeocode(localityLanguage?, endpoint?, server?)

| Parameter | Default | Description | |---|---|---| | localityLanguage | 'en' | Language for locality names (BCP 47) | | endpoint | 'reverse-geocode-client' | API endpoint | | server | 'api.bigdatacloud.net' | API server hostname |


Modern API (.mjs)

detect()Promise<LocationData>

Auto-detects location. Tries GPS first; falls back to IP geolocation if GPS is denied or unavailable.

const location = await geo.detect();

Reverse geocodes the given coordinates directly.

Internal IP fallback (automatic when GPS denied) → Promise<LocationData>

getClientLocation(latLng?, callback) (legacy-compatible)

Callback-based. If latLng is omitted, tries GPS then falls back to IP.

geo.getClientLocation(function(location) {
  console.log(location?.city);
});

// Or with known coords:
geo.getClientLocation({ latitude: -33.8688, longitude: 151.2093 }, function(location) {
  console.log(location.city);
});

getClientCoordinates(callback) (legacy-compatible)

Returns the raw GPS position via callback.

geo.getClientCoordinates(function(position) {
  if (!position) return; // GPS denied
  console.log(position.coords.latitude, position.coords.longitude);
});

LocationData response fields

Key fields returned by the API:

| Field | Type | Description | |---|---|---| | latitude | number | Latitude | | longitude | number | Longitude | | city | string | City/town name | | locality | string | Locality/suburb name | | countryName | string | Country name | | countryCode | string | ISO 3166-1 alpha-2 country code | | principalSubdivision | string | State/province | | postcode | string | Postal code (if available) | | isLandmark | boolean | Whether coordinates fall on a landmark |


Framework-Specific Alternatives

If you're using a framework, consider these dedicated packages:

| Framework | Package | |---|---| | React | @bigdatacloudapi/react-reverse-geocode-client on npm | | Vue / Nuxt | @bigdatacloudapi/vue-reverse-geocode-client on npm | | Flutter / Dart | bigdatacloud_reverse_geocode_client on pub.dev | | Node.js | @bigdatacloudapi/client on npm | | AI / MCP | @bigdatacloudapi/mcp-server on npm |


Fair Use

This client uses BigDataCloud's free, client-side reverse geocoding API. It is intended for browser-based use only — requests must originate from end-user browsers, not from servers or automated scripts.

Please review the Fair Use Policy before integrating.

For server-side or testing use, please use the authenticated Reverse Geocode to City API instead. A free tier is available after sign-up.


Links


© 2026 BigDataCloud Pty Ltd — MIT License