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

psgc-areas

v1.0.0

Published

Provides the full Philippine Standard Geographic Code (PSGC) dataset in JSON with multiple formats (hierarchy, flat list of all areas, regions, provinces, cities, municipalities, municipal districts, and barangays).

Readme

PSGC Areas

Overview

This package provides an interface to access the Philippine Standard Geographic Code (PSGC) data. The PSGC is a systematic classification and coding of geographic areas in the Philippines, essential for various government and private sector activities such as statistical analysis, geographic information systems (GIS), and more.

Features

  • Retrieve PSGC codes and descriptions.
  • Access hierarchical and flat list representations of geographic areas.
  • Efficient and easy-to-use API for integrating PSGC data into applications.

Installation

To install the package, use npm or your package manager of choice (e.g., pnpm):

npm install psgc-areas

Usage

Importing the Package

First, import the package into your project:

import { PSGCResource } from "psgc-areas";

Getting All Areas in Hierarchical Representation

To retrieve a hierarchical representation of all areas with regions at the top:

PSGCResource.getAll()
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error("Error fetching hierarchical data:", error);
  });

Getting a Flat List of All Areas

To get a flat list of all areas from the PSGC publication:

PSGCResource.getAreas()
  .then(areas => {
    console.log(areas);
  })
  .catch(error => {
    console.error("Error fetching areas:", error);
  });

Getting All Regions

To retrieve all regions:

PSGCResource.getRegions()
  .then(regions => {
    console.log(regions);
  })
  .catch(error => {
    console.error("Error fetching regions:", error);
  });

Getting All Provinces

To retrieve all provinces:

PSGCResource.getProvinces()
  .then(provinces => {
    console.log(provinces);
  })
  .catch(error => {
    console.error("Error fetching provinces:", error);
  });

Getting All Cities

To retrieve all cities:

PSGCResource.getCities()
  .then(cities => {
    console.log(cities);
  })
  .catch(error => {
    console.error("Error fetching cities:", error);
  });

Getting All Municipalities

To retrieve all municipalities:

PSGCResource.getMunicipalities()
  .then(municipalities => {
    console.log(municipalities);
  })
  .catch(error => {
    console.error("Error fetching municipalities:", error);
  });

Getting All Municipal Districts

To retrieve all municipal districts:

PSGCResource.getMunicipalDistricts()
  .then(municipalDistricts => {
    console.log(municipalDistricts);
  })
  .catch(error => {
    console.error("Error fetching municipal districts:", error);
  });

Getting All Barangays

To retrieve all barangays:

PSGCResource.getBarangays()
  .then(barangays => {
    console.log(barangays);
  })
  .catch(error => {
    console.error("Error fetching barangays:", error);
  });

API Documentation

Methods

getAll()

  • Description: Fetches a hierarchical representation of all areas with regions at the top.
  • Returns: A promise that resolves to a hierarchical structure of geographic areas.

getAreas()

  • Description: Fetches a flat list of all areas from the PSGC publication.
  • Returns: A promise that resolves to an array of area objects.

getRegions()

  • Description: Fetches all regions.
  • Returns: A promise that resolves to an array of region objects.

getProvinces()

  • Description: Fetches all provinces.
  • Returns: A promise that resolves to an array of province objects.

getCities()

  • Description: Fetches all cities.
  • Returns: A promise that resolves to an array of city objects.

getMunicipalities()

  • Description: Fetches all municipalities.
  • Returns: A promise that resolves to an array of municipality objects.

getMunicipalDistricts()

  • Description: Fetches all municipal districts.
  • Returns: A promise that resolves to an array of municipal district objects.

getBarangays()

  • Description: Fetches all barangays.
  • Returns: A promise that resolves to an array of barangay objects.

Contributing

If you would like to contribute, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or suggestions, please open an issue on GitHub.