{
  "file": "wilaya-boundaries.geojson",
  "title_en": "Algeria: wilaya boundary polygons (69)",
  "title_fr": "Algérie: polygones des limites de wilaya (69)",
  "title_ar": "الجزائر: حدود الولايات (69)",
  "feature_count": 69,
  "geometry_types": { "Polygon": 68, "MultiPolygon": 1 },
  "properties": { "code": "wilaya code as an integer 1–69 (join key to wilayas.json)" },
  "bbox": [-8.669, 18.968, 11.997, 37.09],
  "license": "ODbL-1.0",
  "sources": [
    {
      "key": "osm",
      "name": "OpenStreetMap: administrative boundaries (relation, boundary=administrative, admin_level=4) in Algeria",
      "url": "https://www.openstreetmap.org",
      "license": "ODbL 1.0 (© OpenStreetMap contributors)",
      "retrieved": "2026-06-21",
      "evidence_type": "crowdsourced"
    },
    {
      "key": "osm-communes",
      "name": "OpenStreetMap: commune boundaries (relation, boundary=administrative, admin_level=8) in Algeria, full geometry",
      "url": "https://www.openstreetmap.org",
      "license": "ODbL 1.0 (© OpenStreetMap contributors)",
      "retrieved": "2026-09-29",
      "timestamp_osm_base": "2026-09-29T13:04:54Z",
      "evidence_type": "crowdsourced",
      "note": "Used only for the 2026-09-29 membership correction below, which redraws four of the 69 features. The outlines are recorded in research/_wilaya-boundaries/commune-outlines-2026-09-29.json."
    }
  ],
  "simplification": {
    "method": "mapshaper -simplify dp 2% keep-shapes; the four features the 2026-09-29 membership correction redrew carry a transferred part simplified with Douglas-Peucker at 0.005 degrees (~550 m) instead",
    "coordinate_precision_dp": 3,
    "vertices": 7797,
    "rings": 70,
    "vertex_spacing_m": { "p25": 2116, "median": 3337, "p75": 5704, "p90": 11716, "max": 158315 }
  },
  "provenance_notes": [
    "CORRECTION 2026-09-29, the second place this file deliberately departs from upstream OSM: the territory of three communes was moved to the wilaya each of them declares. El Alia (5513) and El-Hadjira (5507) are communes of Touggourt (55) and 9,049 km2 of them was drawn as Ouargla (30); Mansoura (4713) is a commune of Ghardaia (47) and 4,783 km2 of it was drawn as El Meniaa (58). Same class of defect as the El Aricha correction below: Touggourt was carved out of Ouargla and El Meniaa out of Ghardaia by law 19-12 in 2019, OSM has the new admin_level=4 relations but never shrank the parents, and the commune relations still carry Ouargla-era ONS codes (El Alia is tagged ref:ONS=3020, El-Hadjira 3014), so re-sourcing from OSM reproduces it. Membership is not an OSM question: law 26-06 (JORA n° 25, 5 April 2026) re-states the commune list of the ten 2019 wilayas, decree 26-206 (JORA n° 40, 3 June 2026) fixes the names and chef-lieux, and the ONS code geographique 2021 (sources/dataset/ons-code-geo-2021.json) reads 55 for 5513 and 5507 and 47 for 4713, as does every commune table this package ships. Found by the 2026-09-27 commune-centre sweep (research/_commune-centres/), where all three communes' stored centre AND their OSM chef-lieu node were 5 to 53 km outside their declared wilaya. Owner decision of 2026-09-29: the commune membership decides the line and the polygons follow the communes. Computed by scripts/fix-wilaya-membership.mjs (polygon-clipping) from the commune outlines in research/_wilaya-boundaries/commune-outlines-2026-09-29.json (OSM admin_level=8, timestamp_osm_base 2026-09-29T13:04:54Z): the receiving wilaya is derived as the complement of the shrunken donor inside the pair's own union, so the two share one arc and no third wilaya gains or loses anything. Touggourt 9,775 km2 to 18,831 (published figure 17,428), Ouargla 144,496 to 135,440 (145,805), Ghardaia 21,218 to 26,008 (24,395), El Meniaa 63,353 to 58,563; each pair's total is unchanged to within 0.05 km2, the union of all 69 is unchanged to the same, and each redrawn polygon is within 2% of the union of its own member communes' outlines. A transferred OSM commune ring and this file's own simplified ring describe the same shared border about 30 m apart, so the boolean result carries a zero-width slit; the slits are collapsed at full precision, and the few vertices whose 3-decimal rounding would land inside an untouched wilaya keep full precision instead of opening a sliver or a hole of about 1 km2 along a border that did not move. Vertices 7,759 to 7,797. Two zero-width spikes that predate this file's corrections were removed at the same time, w18 idx 9-11 and w31 idx 2-4, which changes no border; apart from those, every other feature is byte-identical. Private tracker #171. Guarded by test/wilaya-membership.test.mjs and by test/wilaya-boundaries-disjoint.test.mjs, which now bounds every one of the 2,346 pairs at 0.01 km2 of overlap and requires every ring to be simple.",
    "CORRECTION 2026-08-09, the first place this file deliberately departs from upstream OSM: El Aricha (63) was subtracted from Tlemcen (13). El Aricha became its own wilaya in the 2026 reform, carved out of Tlemcen; OSM added the new relation (20815946, ref 63) but never shrank the parent relation (1280702, ref 13), which still spans its pre-reform extent, so 100% of El Aricha also fell inside Tlemcen and a third of the area Tlemcen drew was really El Aricha. Verified against a live Overpass pull on 2026-08-09 (timestamp_osm_base 2026-08-08T16:16:37Z): re-sourcing from OSM reproduces the defect rather than fixing it, which is why the correction lives here. Computed as a polygon difference by scripts/fix-wilaya-overlap.mjs (polygon-clipping), reusing the 24 vertices the two rings already shared, so no sliver was introduced and no territory was lost or gained: Tlemcen 9,098 km2 to 6,083 km2 and El Aricha 3,015 km2 sum back to the original 9,098 km2. Tlemcen went from 127 to 135 vertices; every other feature is byte-identical. Reported by Karim OA (konfo.net) from the Sismoo mobile app, and submitted upstream to OSM. Guarded by test/wilaya-boundaries-disjoint.test.mjs, which fails on the pre-correction geometry.",
    "Imported verbatim from the GeoAlgeria app repo, commit 300cb85 (main), blob 92642be34c678e243e664a55ca7a373dd1f08e94; byte-identical, geometry untouched.",
    "The OSM extraction itself landed in the app repo on 2026-06-21 in commit f107d6a ('fix: replace GADM wilaya boundaries with OSM data (69 wilayas)'), which records the source (OSM admin_level=4 relations), the licence (ODbL) and the simplification (mapshaper dp 2%, keep-shapes). The bytes have not changed since.",
    "retrieved = 2026-06-21 is the commit date of that extraction and therefore an UPPER BOUND on the Overpass pull date. The file carries no timestamp_osm_base or any other provenance field (properties are `code` only), and no fetch script for it exists in either repo, so the exact pull date cannot be established. It is not a guess at a narrower date.",
    "The commonly quoted '~150 m' figure describes the COORDINATE QUANTISATION (3 decimal places ≈ 111 m in latitude, ≈ 96 m in longitude at 30°N), not the simplification error. Douglas-Peucker at 2% left a median vertex spacing of 3.4 km, so the polygon can depart from the true border by far more than 150 m along any simplified stretch. Treat these as display-grade boundaries (good to about z11), not as a survey-grade border test.",
    "Superseded predecessor: the same file was built from GADM 4.1 before f107d6a; app-repo scripts/prepare-boundaries.mjs still builds that version and must never be re-run. An unverified OSM re-extraction is parked on the app-repo branch chore/osm-boundaries and was deliberately NOT used here.",
    "Data licence is ODbL-1.0 while the compilation the geoalgeria npm package ships is MIT. The package also mirrors data/poste under Algérie Poste's own terms, so its data is under three sets of terms and no SPDX expression states them: the package declares SEE LICENSE IN LICENSE and its descriptor carries prose conditionsOfAccess rather than a licence URL. This file is one of the two ODbL carve-outs; the other is the 323 OpenStreetMap-derived commune centre coordinates."
  ]
}
