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

@ph-dev-utils/geo

v0.1.0

Published

Philippine geo utilities — representative coordinates for all PSGC cities/municipalities + haversine distance, nearest-city, and within-radius helpers. Data from GeoNames (CC BY 4.0).

Readme

@ph-dev-utils/geo

npm version License: MIT

Philippine geo utilities for JavaScript/TypeScript — a representative coordinate for every PSGC city/municipality plus haversine distance, nearest-city, and within-radius helpers. Part of the @ph-dev-utils family.

Bundled dataset is browser-safe (compiled in, no network, no fs). Coordinates are keyed by the same 6-digit PSGC cityMunCode as @ph-dev-utils/core and @ph-dev-utils/postal, so they join cleanly.

npm install @ph-dev-utils/geo

Quick start

import { findCoord, distanceKm, nearestCity, withinRadiusKm, listCoords } from '@ph-dev-utils/geo';

findCoord('072217');             // { name: 'City of Cebu', lat: 10.31, lng: 123.89, ... }
findCoord('Cebu City');          // same — "City of X" / "X City" tolerant

distanceKm('133900', '072217');  // ~570  (Manila → Cebu, km)
distanceKm({ lat: 14.6, lng: 121 }, 'Makati'); // accepts raw {lat,lng} too

nearestCity('133900', 5);        // 5 nearest cities to Manila, nearest first (with distanceKm)
withinRadiusKm('133900', 30);    // every city/municipality within 30 km of Manila

listCoords({ region: '07' });    // all coordinates in Region VII (Central Visayas)

API

| Function | Returns | | --- | --- | | listCoords(filter?) | Coordinate[] — filter by region and/or province (null matches NCR / independent cities) | | findCoord(query) | Coordinate \| null — by 6-digit PSGC code or city name ("City of X" / "X City" tolerant) | | distanceKm(a, b) | number \| null — great-circle km; each arg is {lat,lng} or a code/name | | nearestCity(point, n = 1) | NearbyCoordinate[]n nearest, nearest first | | withinRadiusKm(point, km) | NearbyCoordinate[] — all within km, nearest first | | META | provenance + license note for the bundled data |

Coordinate

interface Coordinate {
  cityMunCode: string;        // 6-digit PSGC code (joins @ph-dev-utils/core)
  name: string;
  province: string | null;    // 4-digit province code, or null for NCR / independent cities
  region: string;             // 2-digit region code
  lat: number;
  lng: number;
  points: number;             // GeoNames postal points averaged into this centroid
}

interface NearbyCoordinate extends Coordinate {
  distanceKm: number;         // distance from the query point
}

A point argument (nearestCity, withinRadiusKm, either side of distanceKm) is either a { lat, lng } or a string PSGC code / city name resolvable via findCoord.

Data & disclaimer

Each coordinate is a representative point — the mean of the GeoNames postal-code points that map to the city/municipality — intended for distance/proximity work. It is not an official PSA centroid or a survey-grade location. Coordinates are derived from the GeoNames Philippines postal dump (CC BY 4.0); the ZIP → cityMunCode join is reused from @ph-dev-utils/postal and names/provinces/regions from the PSA Q4 2024 PSGC via @ph-dev-utils/core. See NOTICE for attribution.

License

MIT. Bundled coordinate data © GeoNames, CC BY 4.0.