# Dar al-Bayda map sources and alignment

Open `medina.qgz` in QGIS with this directory intact. It contains three
aligned map scans and three editable GeoPackage layers for points, lines,
and areas. The scans can be toggled independently. The `.vrt` files carry
the alignment for the adjacent WebP images. `medina-geometry.json` stores
working-image coordinates, control points and transforms, fit residuals,
and the simplified paths used by the app.

| Date | Source | Alignment and use |
| --- | --- | --- |
| c. 1900 | [Frédéric Weisgerber, Plan de la ville de Casablanca, 1:6,000](https://commons.wikimedia.org/wiki/File:Casablanca_1900_by_Felix_Weisgerber.png) | Similarity transform from the mapped Sqala, Sidi Allal shrine, and Ould el-Hamra Mosque to existing landmark coordinates. In-sample RMS fit residual 10.7 m. |
| 1907 | [Dyé and Weisgerber, city and roadstead, L’Illustration, 10 August 1907, p. 85](https://sbc.org.pl/Content/144318/PDF/144318.pdf#page=5), [digitized map](https://commons.wikimedia.org/wiki/File:Casablanca_Weisgerber.png) | Registered to the c. 1900 map with nine matching points, mostly on wall corners. In-sample RMS fit residual 30.0 m. Dashed features on the sheet show proposed works. |
| 1912 | [A. Tardif, Plan de Casablanca, 1:5,000, American Geographical Society Library, UW–Milwaukee](https://collections.lib.uwm.edu/digital/collection/agdm/id/1079) | Registered to the c. 1900 sheet with five matching wall and gate points. In-sample RMS fit residual 38.3 m. The sheet contains existing and proposed features. |

Fit residuals summarize the match at the selected control points. They
are not independent measurements of absolute accuracy. The tide datum,
the exact footprint of individual houses, and many landmark facades
remain uncertain. The traced inner wall covers about 47 ha in the app's
local metre grid; `geo.json` `medina` is the same trace simplified to 27
vertices, with the Tnaker and Mellah traces in `medinaQuarters` and the
traced Sour Jdid wall (about 16 ha with the rampart) in `surJdid`. The
model's pre-1907 coastline (`geo.json` `hist`) follows the plan's
high-water line from the lime kiln west of Sour Jdid to the beach below
the Sidi Belyout cemetery, with 12 m of beach in front of the walls, then
the high-water line of the 1907 sheet (`shore1907`, the dash-dot line
marked "la haute mer") east to the sheet's edge, and is joined to the
earlier model coastline outside that stretch. The rocks and beach exposed
at low tide between that line and the earlier coastline are `foreshore`;
the first port pieces fill them in front of the medina, and `land` pieces
east of it. `scripts/refit_pre1907_coast.py` regenerates these from the
traces. The
GeoPackage stores longitude and latitude in EPSG:4326, while the QGIS
project displays UTM zone 29N.

[Bab el-Mersa, 1911](https://commons.wikimedia.org/wiki/File:Bab_El_Marsa_-_1911.JPG),
photographer unrecorded. The photo is supplied for reference alongside an
approximate model view. The source page credits a historic Moroccan
government ports site and carries a Public Domain Mark.
