This simple Typescript library contains all the definitions for the Italian administrative entities:
- Comune
- Provincia
- Regione
with all the entries and some helpers, such as
- get region for comune
- get provincia for comune
- get provinces for a region
- get region from a province
The list of cities in Italy is periodically retrieved and auto-generated by a Python script which fetches the cities from Istat from https://www.istat.it/storage/codici-unita-amministrative/Elenco-comuni-italiani.csv.
The tool can be found at tools/comuni.py
With NPM
npm install comuni-province-regioni
or with Yarn
yarn add comuni-province-regioni
import City, { CITIES_ATTRIBUTES } from 'comuni-province-regioni/lib/city';
const attrs = CITIES_ATTRIBUTES[City.MOIMACCO_030060];
console.log(attrs.name, attrs.province, attrs.region);
import Province, { PROVINCES_BY_REGION, REGION_BY_PROVINCE, provinceToString } from 'comuni-province-regioni/lib/province';
import Region from 'comuni-province-regioni/lib/region';
const regionProvinces = PROVINCES_BY_REGION[Region.PIEMONTE];
for (const province of regionProvinces) {
console.log(provinceToString(province));
// ...
}
const regionOfPordenone = REGION_BY_PROVINCE[Province.PORDENONE];
comuni-province-regioni is licensed under MIT.
See full license HERE.