Metadata-Version: 2.4
Name: sudan-atlas
Version: 0.1.5
Summary: Official codes, names and boundaries for Sudan's states and localities, with a matcher for messy Arabic and English place names.
Author: Amin Shennan
License-Expression: MIT AND CC-BY-3.0-IGO AND CC-BY-4.0 AND ODbL-1.0
Project-URL: Homepage, https://github.com/aminshennan/sudan-atlas
Project-URL: Source, https://github.com/aminshennan/sudan-atlas/tree/main/packages/py
Project-URL: Issues, https://github.com/aminshennan/sudan-atlas/issues
Project-URL: Documentation, https://atlas-sudan.vercel.app/docs/
Project-URL: DOI, https://doi.org/10.5281/zenodo.24191931
Keywords: sudan,gazetteer,p-code,cod-ab,geojson,arabic,place names,geocoding
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Natural Language :: Arabic
Classifier: Natural Language :: English
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE-DATA
Requires-Dist: rapidfuzz>=3.6
Provides-Extra: geo
Requires-Dist: geopandas>=1.0; extra == "geo"
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Dynamic: license-file

# sudan-atlas

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24191931.svg)](https://doi.org/10.5281/zenodo.24191931)

Official codes, names and boundaries for Sudan's 18 states, the Abyei PCA area and 189 localities, with a matcher that turns messy Arabic and English place names into official P-codes.

```sh
pip install sudan-atlas            # matcher and data
pip install "sudan-atlas[geo]"     # plus GeoDataFrames (geopandas)
```

```python
from sudan_atlas import match, get_states, get_localities, get_feature

match("El Hasaheesa", state_hint="Al Gezira", level=2)
# {'pcode': 'SD15034', 'name_en': 'Al Hasahisa', 'name_ar': 'الحصاحيصا', 'level': 2,
#  'score': 0.9, 'method': 'fuzzy', 'alternatives': [...]}

get_states()              # 19 dicts: pcode, name_en, name_ar, level, parent_pcode, point
get_localities("SD15")    # the localities of one state
get_feature("SD15034", "medium")   # GeoJSON Feature dict; "detailed", "medium" or "light"

from sudan_atlas import geo        # needs the [geo] extra
geo.localities("SD02")             # GeoDataFrame, EPSG:4326
```

## Matching

`match(name, state_hint=None, level=None)` tries an exact match on the official names, then a table of known spellings, then fuzzy matching. A state hint (a P-code or a state name in any spelling) limits the search to that state; `level` is 1 for states, 2 for localities.

It never guesses silently. When the best candidate scores below 0.82, or a second place scores almost as high, `pcode` is `None`, `method` is `"ambiguous"` or `"none"`, and `alternatives` lists the best three candidates for a person to choose from. `Matcher(threshold=..., margin=...)` changes those settings.

The npm package (`npm install sudan-atlas`) returns identical results.

## Citing

If you use sudan-atlas in a report, paper or product, please cite it:

> Shennan, A. (2026). *Sudan Atlas: official names, P-codes and boundaries for Sudan's states and localities*. Zenodo. https://doi.org/10.5281/zenodo.24191931

Website, map and map-maker: https://atlas-sudan.vercel.app

## Licences and sources

Each licence covers its own files:

| Files | Licence | Credit |
| --- | --- | --- |
| Code | MIT | |
| Boundaries | CC BY 3.0 IGO | "OCHA (COD-AB Sudan), via HDX; Sudan Atlas" (COD-AB version v03) |
| Places, spellings (`variants.json`), rules | CC BY 4.0 | "Sudan Atlas"; sources include GeoNames (CC BY 4.0) and Wikidata (CC0) |
| OpenStreetMap town spellings (`variants_osm.json` only) | ODbL 1.0 | "© OpenStreetMap contributors" |

The OpenStreetMap spellings are kept in their own file, so the ODbL's share-alike applies to that file alone, not to the boundaries or the other data. Matching results are not under the ODbL. Boundaries do not imply any opinion on the legal status of any territory. Details: https://github.com/aminshennan/sudan-atlas/blob/main/LICENSE-DATA
