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

map-tunisia

v1.4.0

Published

The most accurate open-source SVG maps of Tunisia: 6 nested partitions (country, regions, districts, governorates, delegations, sectors) plus municipalities (baladiyat), a water layer (lakes, sebkhas, chotts, lagoons) and a cities point layer (capital, go

Readme

CI OpenStreetMap data Delegations Gaps & overlaps Code: MIT Data: ODbL

🧭 Live explorer · ⬇️ Download · ⚡ Quick start · 📚 Docs · ✅ Accuracy report


Why Map Tunisia?

Most Tunisia SVGs online are hand-traced, outdated, missing islands, or stop at the 24 governorates. Map Tunisia is built from OpenStreetMap, the most precise open source of Tunisian boundaries, and cross-checked against official INS and ISIE lists. The result is a complete, exactly nested set of maps that you can drop into any project.

🎯 Accurate

  • Real coastline at full precision, with every island: Djerba, Kerkennah, La Galite, Zembra, Kuriat…
  • 0 km² of gaps or overlaps: every level is cut from one planar topology
  • Land area within 0.08 % of the CIA World Factbook
  • Every correction to the raw data is documented with its source

🧩 Complete

  • 6 nested partitions, down to the 2,083 imadas
  • All 279 delegations of the 2024 census, including the 14 created since 2014, which no other open dataset has
  • The 2023 districts (Decree 2023-589) and the 7 economic regions
  • 2014 & 2024 census population built in

🛠️ Ready to use

  • 10 modes: plain, outline, light, dark, labels in Latin, Arabic, Tifinagh and English, nested borders, interactive
  • 5 levels of detail, from 1 m precision to 17 KB icons
  • Semantic ids (ISO 3166-2, INS codes) and data-* attributes in 3 languages
  • GeoJSON + TopoJSON + CSV, a lon/lat → SVG helper, and an explorer

🖼️ Gallery

Six partitions, exactly nested

Ten modes

Five levels of detail (Djerba, at the same zoom)

⚡ Quick start

1. Use a file directly. Every SVG scales to any size:

<img src="https://cdn.jsdelivr.net/gh/Alaa-Taieb/map-tunisia@main/dist/svg/governorates/tunisia-governorates-medium-light.svg"
     alt="Map of the governorates of Tunisia" width="420">

2. Inline it and style it with CSS. Every shape has an id and data-* attributes:

#TN-61 { fill: #ffb703; }                            /* Sfax, by ISO 3166-2 code */
.unit[data-region="sud-ouest"] { fill: #8ecae6; }    /* a whole economic region */
.unit:hover { fill: #e63946; }

3. Add behaviour with a few lines of JavaScript:

document.querySelectorAll('.map-tunisia .unit').forEach((el) =>
  el.addEventListener('click', () =>
    alert(`${el.dataset.nameFr} · ${el.dataset.nameAr} — ${Number(el.dataset.population2024).toLocaleString()} inhabitants`)));

4. Place your own points. All SVGs share one frame (UTM 32N, 1 unit = 1 km):

import { project } from 'https://cdn.jsdelivr.net/gh/Alaa-Taieb/map-tunisia@main/src/projection.js';
const [x, y] = project([10.7600, 34.7406]); // Sfax → SVG coordinates
svg.insertAdjacentHTML('beforeend', `<circle cx="${x}" cy="${y}" r="3" fill="crimson"/>`);

More recipes for React, D3 + TopoJSON, Leaflet, MapLibre, Python (GeoPandas, Plotly), R, QGIS, Figma, print and laser cutting are in the usage guide.

⬇️ Download

Every file lives in dist/ and follows one naming scheme:

dist/svg/<partition>/tunisia-<partition>-<lod>-<mode>.svg     235 SVG maps
dist/geojson/tunisia-<partition>-<lod>.geojson                WGS84, with all attributes
dist/topojson/tunisia-<partition>-<lod>.topojson              WGS84, shared borders
dist/data/<partition>.csv | .json                             names (4 scripts), codes, populations, areas, label points

| Popular file | Size | | --- | ---: | | Governorates, labelled · Arabic · Tifinagh · English | 135 KB | | Governorates, interactive | 135 KB | | Delegations, light | 446 KB | | Sectors (imadas), nested | 1.8 MB | | Municipalities, light · interactive | 506 KB | | Water bodies, light · labelled | 103 KB | | Cities, labelled · Arabic | 253 KB | | Country outline, for icons | 4 KB | | Governorates TopoJSON · GeoJSON | 105 KB · 306 KB |

Browse every combination in the file catalog or the live explorer, or grab everything with Download ZIP.

📦 Install from npm

npm install map-tunisia
import { svgPath, attributesPath, project, catalog } from 'map-tunisia';   // helpers (TypeScript types included)
import delegations from 'map-tunisia/data/delegations.json' with { type: 'json' };   // 279 rows, no fetch needed

delegations.length;                          // 279
catalog.partitions.map((p) => p.count);      // [1, 7, 5, 24, 279, 2083, 338, 67, 284]
svgPath('governorates', 'medium', 'light');  // 'dist/svg/governorates/tunisia-governorates-medium-light.svg'

The maps are plain files, so bundlers and servers can reach them through subpath exports: map-tunisia/svg/…, map-tunisia/geojson/…, map-tunisia/topojson/… and map-tunisia/data/… (for example map-tunisia/geojson/tunisia-governorates-medium.geojson). The package is large (about 49 MB packed, every level of detail included); if you only need one file, use the CDN links above or a release ZIP below. Full API: docs/usage.md.

🗜️ Versioned release ZIPs

Each release ships one ZIP per format plus a checksum file, named after the package version:

| File | Contents | | --- | --- | | map-tunisia-vX.Y.Z-geojson.zip | GeoJSON, every partition and level of detail | | map-tunisia-vX.Y.Z-topojson.zip | TopoJSON, every partition and level of detail | | map-tunisia-vX.Y.Z-json.zip / -csv.zip | attribute tables (names, codes, populations, areas, label points) | | map-tunisia-vX.Y.Z-svg.zip | all 235 SVG maps | | map-tunisia-vX.Y.Z-SHA256SUMS.txt | checksums: sha256sum -c map-tunisia-vX.Y.Z-SHA256SUMS.txt |

Download them from the project's Releases page, or build them yourself from a clone: npm install && npm run release:zip writes everything into release/ (git-ignored). The archives are reproducible: same sources, same bytes.

📦 What's inside

Partitions

| Partition | Units | | Description | | --- | ---: | --- | --- | | country | 1 | تونس | National outline with every island | | regions | 7 | الأقاليم الاقتصادية | INS economic regions: Grand Tunis, Nord-Est, Nord-Ouest, Centre-Est, Centre-Ouest, Sud-Est, Sud-Ouest | | districts | 5 | الأقاليم | The aqalim of Decree 2023-589 (National Council of Regions and Districts) | | governorates | 24 | الولايات | The wilayas, with ids TN-11 … TN-83 (ISO 3166-2) | | delegations | 279 | المعتمديات | The mutamadiyat, INS 2024 nomenclature | | sectors | 2,083 | العمادات | The imadas, the finest administrative level | | municipalities | 338 | البلديات | The baladiyat, a separate layer that does not nest in delegations (below) | | water | 67 | المسطحات المائية | Lakes, dams, sebkhas, chotts and sea-side lagoons, an overlay that leaves the partitions above unchanged (below) | | cities | 284 | المدن | Points: the capital Tunis, the 24 governorate capitals and the municipal seats (below) |

Municipalities (baladiyat)

Municipal borders don't follow delegations or imadas, so the municipalities ship as their own partition: same file names, ids and data-* attributes as the other layers, in SVG (full to low, every mode except nested), GeoJSON, TopoJSON, CSV and JSON. Each one carries its Arabic, French and English names, its governorate (plus region and district), its area, its OSM relation and a label point. Ids look like municipality-7286094 (Zarzis), after the OSM relation.

import municipalities from 'map-tunisia/data/municipalities.json' with { type: 'json' };
import { svgPath } from 'map-tunisia';

municipalities.length;                                   // 338
municipalities.filter((m) => m.governorate === 'TN-82'); // the 10 municipalities of Médenine
svgPath('municipalities', 'medium', 'interactive');      // 'dist/svg/municipalities/tunisia-municipalities-medium-interactive.svg'
.municipality[data-governorate="TN-82"] { fill: #219ebc; }   /* one governorate's municipalities */
#municipalities-base { fill: #eceff3; }                      /* land outside every mapped municipality */

Source: the OpenStreetMap relations tagged boundary=municipality (© OpenStreetMap contributors, ODbL 1.0), from the same extract as the other layers, clipped to the land. No geometry is invented: OSM maps 338 of the 350 municipalities of the 2016 division, so 2.1 % of the land (some sebkhas, and areas not yet mapped) stays outside every municipality and is drawn as a light base under the units. Coverage, the gaps and the OSM relations whose names look wrong are in the accuracy report.

Water: lakes, sebkhas and lagoons

The water layer draws the 67 named water bodies of at least 1 km² over the land: 6 lakes (Ichkeul…), 18 dam reservoirs (Sidi Salem, Sidi El Barrak…), 35 sebkhas (Sidi El Hani, Kelbia, Sejoumi…), the 3 chotts (el-Jérid, el-Fejej, el-Gharsa) and 5 sea-side lagoons (Bizerte, Ghar El Melh, the two Lakes of Tunis, El Bibane). It is an overlay: the governorates, delegations and sectors keep the inland water inside them, so their areas and the zero-gap guarantee do not change, and the lagoons lie on the sea side of the coastline. Same naming scheme as every layer: SVG (full to low, every mode except nested), GeoJSON, TopoJSON, CSV and JSON. In the light, dark and interactive modes open water is blue and salt flats are sand-coloured.

Each body carries its type (lake, reservoir, sebkha, chott or lagoon), its names in Arabic, French and English, its main governorate and every governorate it touches (governorates), its area, salt and intermittent flags, and its OSM way or relation. Ids follow the OSM element: water-r3969167 (Chott el-Jérid, relation 3969167), water-w49730150 (Sebkhet Ariana, way 49730150); the two lagoons cut from the coastline are water-bizerte and water-el-bibane.

import water from 'map-tunisia/data/water.json' with { type: 'json' };

water.filter((w) => w.type === 'lagoon').map((w) => w.name_fr);
// ['Lac de Bizerte', 'Bahiret el Bibane', 'Lagune de Ghar El Melh', 'Lac de Tunis', 'Lac Sud de Tunis']
.water-body[data-type="sebkha"], .water-body[data-type="chott"] { fill: #eadfc4; }
.water-body[data-salt="yes"][data-intermittent="yes"] { fill-opacity: .7; }   /* seasonal salt lakes */
#water-base { fill: none; }                                                  /* drop the land, overlay on your own map */

Source: OpenStreetMap water areas (natural=water lakes, reservoirs and salt lakes, and salt wetlands; rivers, ponds and salt pans are left out), clipped to the land. OSM has no polygon for the Bizerte and El Bibane lagoons, so they are cut from the OSM coastline: the parts of the sea that open to it through a channel narrower than 600 m. Unnamed areas and areas under 1 km² are left out. Every merge, clip and gap is in the accuracy report.

Cities and capitals

The cities layer is a point layer: the capital Tunis, the other 23 governorate capitals and 260 more municipal seats, 284 points in all. Each point has its type (national_capital, governorate_capital or city), capital_of (TN TN-11 for Tunis, TN-61 for Sfax…), its names in Arabic, French and English, its governorate, delegation, sector and municipality, its lon/lat, and its x/y in the shared SVG frame. The SVGs (full to low, every mode except nested) draw the dots over the land and the governorate borders, sized and coloured by type; the labelled modes name every capital and as many other cities as fit (the low level names the capitals only). Ids follow the OSM node: city-n27564968 is Tunis.

import cities from 'map-tunisia/data/cities.json' with { type: 'json' };
import { project } from 'map-tunisia';

const capitals = cities.filter((c) => c.type !== 'city');      // 24: Tunis and the 23 other governorate capitals
const sfax = cities.find((c) => c.capital_of === 'TN-61');
project([Number(sfax.lon), Number(sfax.lat)]);                   // [x, y] on any Map Tunisia SVG, equal to sfax.x / sfax.y

Source: OpenStreetMap only. Tunis is the admin_centre of the country relation (tagged capital=yes), each governorate capital is the admin_centre of its governorate relation, and a municipal seat is the admin_centre of its municipality or the settlement node of the same name inside it. No point is typed in by hand: 56 of the 338 OSM municipalities have no such node (and 12 municipalities are not in OSM at all, Sfax and Sidi Bouzid among them), so they have no seat point; the list is in the accuracy report. There is no population threshold: OSM population tags are too sparse.

Levels of detail

| Level | Tolerance | Use it for | Governorates file | | --- | ---: | --- | ---: | | full | none (OSM precision) | GIS, print, deep zoom | 1.3 MB | | high | ≈ 20 m | posters, zoomable maps | 390 KB | | medium | ≈ 100 m | websites, dashboards, slides | 135 KB | | low | ≈ 500 m | small embeds, mobile | 37 KB | | tiny | ≈ 2.5 km | icons, thumbnails | 17 KB |

Modes

| Mode | | Mode | | | --- | --- | --- | --- | | plain | neutral, ready for your CSS | labeled | names in Latin script, callouts where crowded | | outline | strokes only: print, laser, overlays | labeled-ar | names in Arabic, right-to-left | | light | colourful, neighbours never share a colour | labeled-tfng | names in Tifinagh (ⵜⵉⴼⵉⵏⴰⵖ) | | dark | for dark UIs | labeled-en | English names in plain ASCII | | nested | higher-level borders drawn heavier | interactive | hover + tooltips, no JavaScript |

The labelled modes exist wherever labels do: the medium, low and tiny levels of every layer that has them (medium and low for delegations, sectors, municipalities, water and cities; the cities also at full and high).

Tifinagh and English names. Every attribute table carries name_tfng, name_tfng_source and name_translit. name_tfng is the Tamazight name OpenStreetMap holds in Tifinagh (name:zgh, then name:ber, …) where there is one, for example ⵜⵉⵟⵟⴰⵡⵉⵏ (Tataouine) or ⵜⴰⴽⴻⵔⵡⴰⵏⵜ (Kairouan); OSM has 11 for the units published here. Every other unit gets its Arabic name transliterated letter by letter into Neo-Tifinagh (IRCAM letters: تونس → ⵜⵓⵏⵙ, القيروان → ⵍⵇⵉⵔⵡⴰⵏ), and name_tfng_source says which (osm or transliterated). A transliteration is not a Tamazight name: no name is invented or translated. name_translit is the English transliteration: the Latin name in plain ASCII with English generic terms (Gabès → Gabes, Grand Tunis → Greater Tunis, Lac de Bizerte → Lake Bizerte, Barrage de Sidi Salem → Sidi Salem Dam). Tifinagh needs a font that has it: Windows ships Ebrima; elsewhere install the free Noto Sans Tifinagh. Rules and edge cases: partitions, levels & modes.

Details and guidance: partitions, levels & modes · every id and attribute: data dictionary.

✅ Accuracy

Map Tunisia starts from OpenStreetMap and fixes what raw OSM gets wrong. Everything is reproducible and documented in the accuracy report, regenerated with every build.

| | Raw OpenStreetMap | Map Tunisia | | --- | --- | --- | | Delegations | 264 + a stale duplicate (2014 nomenclature) | 279, matching the INS 2024 list code by code | | Nesting | levels drawn independently; lakes missing from delegations | one planar topology: 0 gaps, 0 overlaps | | Kébili and Jendouba | 10 sectors in the wrong delegation | reassigned, checked against INS codes and ISIE maps | | Names | rotated or duplicated names, typos, invisible characters | 24 names corrected; Unicode normalised | | Country polygon | includes the 12-NM territorial sea | land only, following the coastline | | Islets | 63 mapped only as coastline | included |

How it works: all boundaries are noded into one set of faces, conflicts are resolved by documented rules, inland lakes are split by nearest-boundary allocation, and post-2014 delegations are rebuilt from their imadas using the electoral authority's (ISIE) official lists. Then mapshaper simplifies with topology preserved. Read the methodology.

🧭 One frame, real kilometres

Every SVG uses the same viewBox="0 0 406 838" in WGS 84 / UTM zone 32N with 1 unit = 1 km. Files of different partitions overlay perfectly, distances can be read straight off the map, and the dependency-free project() helper (tested to < 1 mm against PROJ) places any longitude/latitude. See projection & coordinates.

🛠️ Build from source

npm install
npm run build        # dist/ from data/ in ~30 s
npm test             # 300 checks: counts, ids, nesting, areas, populations, water, cities, labels, XML validity, sizes, projection, package + ZIPs
npm run release:zip  # versioned ZIPs + SHA256SUMS into release/

# refresh from the latest OpenStreetMap data (Python 3.10+)
pip install -r scripts/extract/requirements.txt
npm run fetch && npm run extract && npm run extract:municipalities && npm run extract:water && npm run extract:cities && npm run extract:tifinagh && npm run build

The pipeline: pyosmium + Shapely (extraction and topology) → mapshaper (dissolve, projection, simplification) → a custom SVG writer (labels with polylabel, map colouring, accessible markup). See CONTRIBUTING.md.

🗺️ Roadmap

  • [x] 6 nested partitions, 5 levels of detail, 10 modes
  • [x] All 279 delegations of the 2024 nomenclature
  • [x] GeoJSON / TopoJSON / CSV, projection helper, live explorer
  • [x] Municipalities (baladiyat) as a separate, non-nested partition
  • [x] Optional water layer: lagoons, sebkhas, chotts and dams
  • [x] Cities and capitals as point layers
  • [x] Tamazight (Tifinagh) and English-transliteration label modes
  • [x] npm package (types, JSON data exports) and versioned release ZIPs with checksums

Ideas and votes are welcome in the issues.

🤝 Contributing

Spotted a wrong border, name or code? Report a data error. It's the most valuable contribution you can make. Code, docs and new modes are welcome too: see CONTRIBUTING.md and the Code of Conduct.

📜 License & attribution

  • Code (scripts, src/, explorer, tests): MIT
  • Maps and data (dist/, data/, illustrations): ODbL 1.0, derived from OpenStreetMap

When you use the maps, please credit:

Map data © OpenStreetMap contributors · Map Tunisia by Alaa Taieb

Using Map Tunisia in research? See CITATION.cff (GitHub's Cite this repository button).

👤 Author

Map Tunisia is created and maintained by Alaa Taieb.

If this project helps you, please ⭐ star the repository, share it, and credit it when you publish a map. It helps others find it.

Acknowledgements

  • The thousands of OpenStreetMap contributors who mapped Tunisia's boundaries, municipalities, towns, lakes, sebkhas and coastline
  • Institut National de la Statistique (INS) for the geocodes and census figures, and the ISIE for its public circonscription maps
  • Geofabrik for the daily extracts
  • mapshaper, pyosmium, Shapely, pyproj and polylabel, the open-source tools this project stands on