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

@bigdatacloudapi/vue-reverse-geocode-client

v1.0.1

Published

Vue composable for free reverse geocoding — get city, country, and locality from GPS coordinates with automatic IP geolocation fallback. No API key needed.

Readme

@bigdatacloudapi/vue-reverse-geocode-client

Vue composable for free reverse geocoding — get city, country, and locality from GPS coordinates with automatic IP geolocation fallback. No API key needed.

npm license


Install

npm install @bigdatacloudapi/vue-reverse-geocode-client
yarn add @bigdatacloudapi/vue-reverse-geocode-client
pnpm add @bigdatacloudapi/vue-reverse-geocode-client

Quick Start

<script setup>
import { useGeoLocation } from '@bigdatacloudapi/vue-reverse-geocode-client';

const { data, loading, error, source } = useGeoLocation();
</script>

<template>
  <p v-if="loading">Detecting location...</p>
  <p v-else-if="error">Error: {{ error }}</p>
  <div v-else>
    <h1>📍 {{ data?.city }}, {{ data?.countryName }}</h1>
    <p>Detected via: {{ source }}</p>
  </div>
</template>

That's it. No API key, no configuration, no backend required.


How It Works

  1. GPS first — requests the browser's Geolocation API (enableHighAccuracy: true)
  2. IP fallback — if the user denies GPS or it's unavailable, the API automatically geolocates by IP address
  3. Reverse geocode — coordinates (or IP) are resolved to a full locality via BigDataCloud's free API

No server-side proxy needed — the API is called directly from the browser.


API

useGeoLocation(options?)

The main composable. Call it in <script setup> or inside setup().

Options

| Option | Type | Default | Description | |---|---|---|---| | language | string | Browser language | Locality language code (e.g. 'en', 'de', 'zh') | | manual | boolean | false | If true, don't fetch on mount — call refresh() manually | | timeout | number | 10000 | GPS timeout in milliseconds |

Returns

| Property | Type | Description | |---|---|---| | data | Ref<LocationData \| null> | The full location response | | loading | Ref<boolean> | true while fetching | | error | Ref<string \| null> | Error message, if any | | source | Ref<'gps' \| 'ip' \| null> | How the location was detected | | refresh | () => void | Re-trigger the location lookup |

Parameters

| Parameter | Type | Description | |---|---|---| | coords | { latitude: number, longitude: number } | Optional. Omit for IP-based geolocation. | | language | string | Optional locality language code. |

LocationData

interface LocationData {
  latitude: number;
  longitude: number;
  lookupSource: string;
  continent: string;
  continentCode: string;
  countryName: string;
  countryCode: string;
  principalSubdivision: string;
  principalSubdivisionCode: string;
  city: string;
  locality: string;
  postcode: string;
  plusCode: string;
  localityInfo: {
    administrative: LocalityInfoEntry[];
    informative: LocalityInfoEntry[];
  };
}

Examples

Multi-language

<script setup>
import { useGeoLocation } from '@bigdatacloudapi/vue-reverse-geocode-client';

// Get locality names in German
const { data, loading } = useGeoLocation({ language: 'de' });
</script>

Manual trigger

<script setup>
import { useGeoLocation } from '@bigdatacloudapi/vue-reverse-geocode-client';

const { data, loading, refresh } = useGeoLocation({ manual: true });
</script>

<template>
  <button @click="refresh" :disabled="loading">
    {{ loading ? 'Detecting...' : 'Detect my location' }}
  </button>
  <p v-if="data">{{ data.city }}, {{ data.countryName }}</p>
</template>

Nuxt 3

Works out of the box in Nuxt 3 — no plugins or special configuration needed. Just import and use:

<!-- pages/index.vue -->
<script setup>
import { useGeoLocation } from '@bigdatacloudapi/vue-reverse-geocode-client';

const { data, loading, error, source } = useGeoLocation();
</script>

<template>
  <div>
    <p v-if="loading">Detecting location...</p>
    <p v-else-if="error">{{ error }}</p>
    <div v-else-if="data">
      <h1>{{ data.city }}, {{ data.countryName }}</h1>
      <p>{{ data.continent }} · {{ data.principalSubdivision }}</p>
      <p>Source: {{ source }}</p>
    </div>
  </div>
</template>

Note: Since this composable uses navigator.geolocation, it only runs client-side. During SSR, data will be null and loading will be false until the component hydrates in the browser.

Using the standalone function

// In a Pinia store, utility, or anywhere
import { reverseGeocode } from '@bigdatacloudapi/vue-reverse-geocode-client';

export async function getLocationLabel(): Promise<string> {
  const loc = await reverseGeocode();
  return `${loc.city}, ${loc.countryName}`;
}

Why BigDataCloud?

  • Free — no API key, no sign-up, no credit card
  • Fast — global CDN, sub-100ms responses
  • Accurate — powered by BigDataCloud's proprietary geocoding database
  • Privacy-friendly — no cookies, no tracking, no personal data stored

Fair Use

This package uses BigDataCloud's free reverse geocoding API. It's intended for light, client-side use — perfect for showing a visitor their detected city, personalizing content, or building location-aware UIs.

For high-volume, server-side, or commercial use, please use an API key.


Need More?

BigDataCloud offers a full suite of geolocation and data APIs:

Visit bigdatacloud.com for the full API catalog.


License

MIT © BigDataCloud Pty Ltd