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

rwanda-location-lookup

v1.1.2

Published

Turn map coordinates into Rwanda's Province, District, Sector, Cell and Village using bundled boundary data.

Readme

rwanda-location-lookup

Convert map coordinates to Rwanda's full administrative hierarchy in one call.

Give the package a latitude and longitude, and it returns:

  • Province
  • District
  • Sector
  • Cell
  • Village

Bundled boundary data is included, so developers can install and use it directly without downloading shapefiles.

lookup() auto-loads bundled GeoJSON and now handles Vite optimized-deps paths without manual public/geo copy steps.

Install

npm install rwanda-location-lookup

Demo

Live demo: rwanda-location-lookup.vercel.app

Use it to test:

  • Coordinates to Province, District, Sector, Cell, Village
  • Current device location lookup
  • Reverse lookup from hierarchy to center coordinates

Quick Start

import { lookup } from "rwanda-location-lookup";

const result = await lookup({
  latitude: -1.944,
  longitude: 30.062,
});

console.log(result);

Example output:

{
  province: "Kigali City",
  district: "Nyarugenge",
  sector: "Nyarugenge",
  cell: "Kiyovu",
  village: "Ishema",
  ids: {
    province: 1,
    district: 11,
    sector: 1109,
    cell: 110903,
    village: "11090308"
  }
}

API (Short and Clean)

  • lookup(...) : Async one-call lookup using bundled Rwanda data.

  • loadData() : Async load + cache bundled data once.

  • lookupByCoords(...) : Sync lookup using coordinates and already-loaded data.

  • lookupByPoint(...) : Sync lookup using a GeoJSON Point and already-loaded data.

  • toPoint(...) : Convert { latitude, longitude } (or { lat, lng }) to a GeoJSON Point.

  • validateData(...) : Validate the districts/sectors/cells/villages FeatureCollections.

  • center(...) : Async reverse lookup using bundled data. Provide hierarchy names/ids and get center coordinates.

  • centerBy(...) : Sync reverse lookup using already-loaded data.

High-Performance Usage (Many Requests)

import { loadData, lookupByCoords } from "rwanda-location-lookup";

const data = await loadData();

const a = lookupByCoords({ latitude: -1.944, longitude: 30.062, data });
const b = lookupByCoords({ lat: -1.95, lng: 30.06, data });

Reverse Lookup (Hierarchy -> Center Coordinates)

import { center } from "rwanda-location-lookup";

const result = await center({
  province: "Kigali City",
  district: "Nyarugenge",
  sector: "Nyarugenge",
  cell: "Kiyovu",
  village: "Ishema",
});

console.log(result.center); // { latitude: ..., longitude: ... }

Use Your Own GeoJSON Source

import { loadDataFromUrl, lookupByCoords } from "rwanda-location-lookup";

const data = await loadDataFromUrl({ baseUrl: "/geo" });
const result = lookupByCoords({ latitude: -1.944, longitude: 30.062, data });

Contributing

Repository: https://github.com/kozera920/rwanda-location-lookup.git

  1. Fork the repository on GitHub.
  2. Clone your fork:
git clone https://github.com/kozera920/rwanda-location-lookup.git
cd rwanda-location-lookup
  1. Add upstream remote:
git remote add upstream https://github.com/kozera920/rwanda-location-lookup.git
  1. Install dependencies:
cd packages/rwanda-location-lookup
npm install
  1. Create a branch for your fix:
git checkout -b fixes/<short-fix-name>
  1. Make changes, test, then commit:
git add .
git commit -m "fix: short description of your fix"
  1. Push your fixes branch:
git push origin fixes/<short-fix-name>
  1. Open a Pull Request from your fixes/... branch to main.

Author

Built and maintained by Kozera Isaie Found a bug or have a suggestion? Open an issue.

Note

Bundled GeoJSON (especially villages) is large, so package install size is bigger than a typical utility package.