geoalgeria (Python)
Algeria's 69 wilayas, 551 dairas and 1,541 communes, with postal codes,
coordinates and Arabic/French search. No dependencies. The data is the
GeoAlgeria open dataset, the same
one behind the geoalgeria npm package and geoalgeria.com,
and search folds names exactly as the npm package does.
pip install geoalgeria
import geoalgeria
geoalgeria.wilaya(31)["name_ar"] # 'وهران'
geoalgeria.commune(101)["postal_code"] # '01000'
len(geoalgeria.communes(16)) # communes of Algiers
geoalgeria.dairas(30) # dairas of Ouargla
geoalgeria.search("ورقلة") # Arabic, with or without harakat
geoalgeria.search("bejaia", types=["commune"], limit=5)
geoalgeria.lineage() # where each wilaya was before 2019 and 2026
geoalgeria.DATA_VERSION # GeoAlgeria data release bundled
Records
Each commune has code_commune, name_fr, name_ar, wilaya_code, daira,
postal_code, latitude, longitude, osm_relation_id and wikidata.
Wilaya codes follow the 2026 reform (69 wilayas). Each commune also carries
wilaya_code_58 and wilaya_code_48: its wilaya on the 58-wilaya map (2019 to
2026) and on the 48-wilaya map (1984 to 2019), so older data joins on the code
it was written with.
Each daira has id, name_fr, name_ar, wilaya_code, commune_count,
communes (member codes), seat_commune_code, kind (daira, or
circonscription in Algiers) and an audit with its status and citation: decree_table when a whole-wilaya
decree table names it, agrees_1991 when it matches the 1991 table, and no
grade yet otherwise. These are the dataset's 551 checked dairas, not dairas
regrouped from the communes.
lineage() returns, for each of the 69 wilayas, its codes on the 58 and 48
maps with the legal texts that say so, plus the commune transfers and the one
exception (El Borma).
Search
search(query, limit=10, types=None) returns wilayas, dairas and communes,
best first:
>>> geoalgeria.search("ورقله", limit=1)
[{'type': 'wilaya', 'code': 30, 'name_fr': 'Ouargla', 'name_ar': 'ورقلة', 'wilaya_code': 30, 'match': 'loose'}]
match says how the name matched: exact, then prefix (the name starts with
what was typed, the last word may be unfinished), then loose (equal or prefix
once ى reads as ي and ة as ه). Within each, wilayas come before dairas, then
communes, then by French name. A result found only by a former name, such as
Lemcene for Lemsane, also has "matched": "former". limit=None returns every
match, and types keeps only some of "wilaya", "daira" and "commune".
Accents, harakat, hamza forms, tatweel and case never matter. The same fold is
public as conservative_key() and loose_key(), with tokenize() for its
words, if you build your own index. They give the same keys as the npm
@geoalgeria/normalize, character for character.
Changes in 0.2.0
search()results are{type, code, name_fr, name_ar, wilaya_code, match}instead of whole records, and include dairas. Usecommune(code)orwilaya(code)for the full record.dairas()returns the audited daira records, each with itscommuneslist of member codes,seat_commune_codeandkind.normalize()is deprecated and now returnsconservative_key(), which keeps ة and ى as they are. Useloose_key()for the 0.1.0 reading of those two letters. Keys saved with 0.1.0 should be rebuilt.
Licence
Code and the compilation (codes, names, postal codes) are MIT. The OpenStreetMap-derived parts (323 commune centre coordinates, OSM relation ids and Wikidata items) are ODbL 1.0, © OpenStreetMap contributors. Full terms in LICENSE and NOTICE. If you reuse the data, credit GeoAlgeria and OpenStreetMap.
Corrections: open an issue.
Metadata
Release files for geoalgeria 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geoalgeria-0.2.0.tar.gz | 121.8 kB | Without provenance | Details for geoalgeria-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geoalgeria-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for geoalgeria-0.2.0-py3-none-any.whl |
Total release size: 246.7 kB
Release files / geoalgeria-0.2.0.tar.gz
| Download URL | geoalgeria-0.2.0.tar.gz |
|---|---|
| Size | 121.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf90dfddbb88e1d4c831a794a6f94078aaca6d0f6f36c9b1fe5718aae4182599
|
|
BLAKE2b-256 checksum How to use checksums |
2dae27f9827cc62fbb81f9062a972a18865c1f0b9f77003f0304851b526544f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / geoalgeria-0.2.0-py3-none-any.whl
| Download URL | geoalgeria-0.2.0-py3-none-any.whl |
|---|---|
| Size | 124.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5376f321f4631aeec172e2697b871d891e79fed2ee7a595483b9763bd3f72c64
|
|
BLAKE2b-256 checksum How to use checksums |
711b6dcac06f6c16517c0c2039762742e2b25395404546da0b6b9921ecf4e3ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for geoalgeria 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.