1.1.0 • Published 2 years ago

@dctsph/psgc v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

About

A collection of Philippine Standard Geographic Code that were broken down by:

  • Barangays
  • Cities / Municipalities
  • Provinces
  • Regions

PSGC Publication Date

Collection Samples

Barangay

{ "name": "Bayanan", "bgy_code": "042103004", "mun_code": "042103000" }

City/Municipality

{ "name": "City of Bacoor", "mun_code": "042103000", "prv_code": "042100000" }

Province

{ "name": "Cavite", "prv_code": "042100000", "reg_code": "040000000" }

Region

{ "name": "Region IV-A (CALABARZON)", "reg_code": "040000000" }

Installation

$ npm install @dctsph/psgc

Usage

Import the package in your application.

import psgc from "@dctsph/psgc";

Available Methods

MethodDescriptionExample
getAllRegions()Show all regions.psgc.getAllRegions()
getAllProvinces()Show all provinces. Usage:Use this if you want to start the filter by province instead of region and use the getRegionByProvince method to get the selected province's region.psgc.getAllProvinces()
getBarangaysByMunicipality(mun_code)Get all barangays by municipality.psgc.getBarangaysByMunicipality('042103000')
getMunicipalitiesByProvince(prv_code)Get all municipalities by province.psgc.getMunicipalitiesByProvince('042100000')
getProvincesByRegion(reg_code)Get all provinces by region.psgc.getProvincesByRegion('040000000')
getBarangaysByProvince(prv_code)Get all barangays by province.psgc.getBarangaysByProvince('042100000')
getRegionByProvince(prv_code)Get region by province.psgc.getRegionByProvince('042100000')

⚠️ Note:

  • Getting the list of all barangays will not be added to avoid any performance issues due to its large number of items.

References

License

Licensed under MIT