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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@doncicuto/es-municipalities

v1.0.0

Published

NPM package containing the name and INE code of Spain's municipalities

Downloads

83

Readme

ES-Municipalities

This package offers Spain's municipalities names and codes as shown in INE (Spain's National Statistics Institute).

According to Wikipedia:

A municipality is usually a single administrative division having corporate status and powers of self-government or jurisdiction as granted by national and regional laws to which it is subordinate.

Also Wikipedia has an specific page for municipalities of Spain.

XLSX Files provided by INE are updated the first day of every year and can be found at https://www.ine.es/dyngs/INEbase/es/operacion.htm?c=Estadistica_C&cid=1254736177031&menu=ultiDatos&idp=1254734710990.

Every change after the first day of the year is logged in the same page and this package will update its data accordingly. Information about new changes will be shown in this README file.

This package contains the data extracted from the information contained in an XLSX file provided by INE.

This package offers two files:

  • An index.js file that contains an array with municipalities,
  • A JSON file that you can read and parse to be offered using a REST API or to insert records into a database.

Install

yarn add @doncicuto/es-municipalities

or

npm install @doncicuto/es-municipalities --save

Usage

The default export is an array of objects with the following structure:

| Property | Type | Description | Example | | ---------- | -------- | ------------------------------- | ----------------- | | commCode | string | INE's Autonomous community code | 07 | | provCode | string | INE's province code | 47 | | code | string | INE's municipality code | 186 | | dc | string | Control digit | 8 | | name | string | province name | Valladolid |

You can use @doncicuto/es-provinces and/or @doncicuto/es-autonomous-communities if you want to use the province and autonomous community codes to get the province and community names.

WARNING Be warned that this array contains 8131 municipalities so it may be heavy for your usage case. You may prefer to use the JSON file called 'municipalitiesWithProvinces.json' contained in the lib folder.

Example (Browser):

import municipalities from "@doncicuto/es-municipalities";

const names = municipalities.map((p) => p.name);
console.log(names);

const filtered = municipalities.filter((p) => p.commCode === "07");
console.log(filtered);

Example (NodeJS):

const municipalities = require("@doncicuto/es-municipalities").default;

const names = municipalities.map((p) => p.name);
console.log(names);

const filtered = municipalities.filter((p) => p.commCode === "07");
console.log(filtered);