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 🙏

© 2025 – Pkg Stats / Ryan Hefner

geo-bounds-utility

v1.0.0

Published

Calculate bounding coordinates for geospatial queries using radius in kilometers

Readme

Geo Bounds Utility

A TypeScript utility to compute bounding coordinates for a geolocation and determine if a point lies within those bounds. Useful for geospatial filtering without expensive distance calculations.

API Reference

Full API documentation is available at: https://dimitardanailov.github.io/geo-bounds-utility

CI

Installation

npm install geo-bounds-utility

Usage

The package exports two main functions and related types:

import {
  calculateBoundingCoordinates,
  isPointWithinBounds,
  GeoPoint,
  type GeoLocation,
  type BoundingCoordinates,
} from "geo-bounds-utility";

GeoLocation

A GeoLocation object defines a circular area.

type GeoLocation = {
  lat: number; // Latitude of the center
  lng: number; // Longitude of the center
  radiusKm: number; // Radius in kilometers
  name?: string; // Optional name
};

GeoPoint

A GeoPoint represents a specific point with latitude and longitude.

class GeoPoint {
  constructor(latitude: number, longitude: number);
  readonly latitude: number;
  readonly longitude: number;
  isEqual(other: GeoPoint): boolean;
}

calculateBoundingCoordinates(location: GeoLocation): BoundingCoordinates

Returns the bounding box (in degrees) that encloses a circular area defined by a center and radius.

import { calculateBoundingCoordinates } from "geo-bounds-utility";

const bounds = calculateBoundingCoordinates({
  lat: 40.7128,
  lng: -74.006,
  radiusKm: 10,
});

// {
//   minLat: 40.622867,
//   maxLat: 40.802733,
//   minLng: -74.120694,
//   maxLng: -73.891306
// }

isPointWithinBounds(geoPoint?: GeoPoint, geoLocation?: GeoLocation): boolean

Determines if a GeoPoint (from firebase-admin) falls within the bounding box defined by a GeoLocation.

import { GeoPoint } from "firebase-admin/firestore";
import { isPointWithinBounds } from "geo-bounds-utility";

const point = new GeoPoint(40.713, -74.007);
const center = { lat: 40.7128, lng: -74.006, radiusKm: 10 };

const inside = isPointWithinBounds(point, center); // true

Development

To build and test the project:

npm install
npm run build
npm run test