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

ground-codes

v0.0.8

Published

Ground codes

Readme

ground-codes

Overview

The ground-codes package is the core implementation of the Ground Codes coordinate-based addressing system. This package provides the fundamental encoding and decoding functionality that powers the entire Ground Codes ecosystem.

Ground Codes is a coordinate-based addressing system that allows you to pinpoint any location in the world using just a region name and two words (e.g., "Yongsan-Happiness-Smile"). It leverages geographic coordinate systems (GCS) to provide a user-friendly alternative to traditional latitude and longitude coordinates.

[!WARNING] ground-codes is an ongoing project and has not yet reached completion.

Installation

npm install ground-codes
# or
yarn add ground-codes
# or
pnpm add ground-codes

Usage

Encoding Coordinates

Convert geographic coordinates (latitude/longitude) into a human-readable Ground Codes address:

import { encode } from "ground-codes";

// Example: Encode a specific location
const address = await encode(
  { lat: 37.5326, lng: 127.0246 }, // Target coordinates
  {
    regionLevel: 2, // Use region name (default)
    precisionMeters: 3, // 3-meter precision (default)
    language: "English", // English output (default)
  }
);

// Result: "Yongsan-Happiness-Smile" (example)
console.log(address);

Decoding Ground Codes

Convert a Ground Codes address back to geographic coordinates:

import { decode, findClosestRegion } from "ground-codes";

// First, get the region center point
const region = await findClosestRegion(
  { lat: 37.5326, lng: 127.0246 }, // Approximate location
  { regionLevel: 2 } // Use region name (default)
);

// Then decode the encoded part
const coordinates = decode({
  encoded: "Happiness-Smile", // The encoded part after region name
  center: { lat: region.lat, lng: region.lng },
});

// Result: { lat: 37.5326, lng: 127.0246 } (approximate)
console.log(coordinates);

Key Features

  • Simple and Memorable: Just three words to identify any location precisely
  • Global Coverage: Works anywhere in the world with a unique address
  • Open Source: MIT licensed and fully transparent implementation
  • Multilingual Support: Currently available in Korean and English, with plans to expand to 60 languages
  • Variable Precision: Offers three levels of precision (3m, 30cm, and 3cm) to suit different use cases

API Reference

encode(target, options?)

Encodes geographic coordinates into a Ground Codes address.

Parameters:

  • target: { lat: number, lng: number } - The target coordinates to encode
  • options (optional):
    • center: { lat: number, lng: number } - Custom center point (if not provided, closest region is used)
    • regionLevel: number - Region level (1 = code format, 2+ = name format)
    • precisionMeters: number - Precision in meters (default: 3)
    • language: SupportedLanguage - Output language (default: 'en')

Returns: Promise<string> - The encoded Ground Codes address

decode({ encoded, center })

Decodes a Ground Codes address back to geographic coordinates.

Parameters:

  • encoded: string - The encoded part of the Ground Codes address
  • center: { lat: number, lng: number } - The center point coordinates

Returns: { lat: number, lng: number } - The decoded geographic coordinates

findClosestRegion(target, options?)

Finds the closest region to the given coordinates.

Parameters:

  • target: { lat: number, lng: number } - The target coordinates
  • options (optional):
    • regionLevel: number - Region level to search for
    • language: SupportedLanguage - Language for region names

Returns: Promise<{ name: string, code: string, lat: number, lng: number }> - The closest region

Precision Levels

Ground Codes offers different precision levels through simple syntax changes:

  • Yongsan-Happiness-Smile (3m precision) - Standard precision, ideal for general location finding
  • Yongsan#Happiness#Smile (30cm precision) - Higher precision for detailed navigation
  • Yongsan+Consideration+Happiness+Smile (3cm precision) - Highest precision for exact positioning

Technical Details

Ground Codes uses a custom GIS algorithm called "Grok Spiral" that determines coordinates by moving in a clockwise spiral from a central point. This implementation leverages the "Gauss Circle Problem" formula to achieve O(sqrt N) efficiency in coordinate generation. The spiral pattern maintains a circular shape regardless of distance from the center point, resulting in excellent coordinate indexing efficiency.

Integration with Other Packages

This package works seamlessly with other Ground Codes ecosystem packages:

  • @repo/geoint: Provides the geographical information database
  • @repo/codebook: Manages the word codebooks used in the encoding system

License

MIT License