Description
Follow-up (backend side) of zigzagdev/world-heritage-frontend#387.
For transnational/serial World Heritage properties (one property spread across multiple countries), getHeritageById/getAllHeritages currently expose:
- a single
(latitude, longitude) pair per site,
- a single
main_image_url / per-image list with no country information attached.
Neither is linked to state_party_codes / primary_state_party_code, so the thumbnail image and the map pin can end up depicting different countries, and neither necessarily matches the displayed primary country.
Example: id 1321 ("The Architectural Work of Le Corbusier..."), 7 countries (ARG, BEL, CHE, DEU, FRA, IND, JPN):
main_image_url → depicts the Curutchet House in La Plata, Argentina.
latitude/longitude → 46.4684139, 6.8293361, which points to Switzerland.
primary_state_party_code → IND (India).
Three different countries depending on which field is read.
Root cause
UNESCO's source dataset stores exactly one (latitude, longitude) pair per heritage site record, even for serial/transnational properties spanning many countries and physical locations (see world_heritage_sites table — single latitude/longitude columns). Per-image data (world_heritage_site_images) has no country_code column, so there's no way to know which country a given image belongs to, or to pick an image consistent with a given coordinate (or vice versa).
Suggested direction (needs a decision before implementing)
- Minimal fix: keep a single stored coordinate per site, but change
main_image_url/thumbnail selection logic to prefer an image known to be from primary_state_party_code. Coordinate itself stays as-is (still potentially "wrong" relative to the primary country, but at least the thumbnail and the country label agree).
- Fuller fix: extend the schema — add a
country_code (or state_party_code) column to world_heritage_site_images, and/or store per-sub-site coordinates for serial properties — then expose enough of that in the API response for the frontend to pick a coordinate/image pair that's mutually consistent.
Acceptance Criteria
Related: zigzagdev/world-heritage-frontend#387
Description
Follow-up (backend side) of zigzagdev/world-heritage-frontend#387.
For transnational/serial World Heritage properties (one property spread across multiple countries),
getHeritageById/getAllHeritagescurrently expose:(latitude, longitude)pair per site,main_image_url/ per-image list with no country information attached.Neither is linked to
state_party_codes/primary_state_party_code, so the thumbnail image and the map pin can end up depicting different countries, and neither necessarily matches the displayed primary country.Example: id 1321 ("The Architectural Work of Le Corbusier..."), 7 countries (ARG, BEL, CHE, DEU, FRA, IND, JPN):
main_image_url→ depicts the Curutchet House in La Plata, Argentina.latitude/longitude→46.4684139, 6.8293361, which points to Switzerland.primary_state_party_code→ IND (India).Three different countries depending on which field is read.
Root cause
UNESCO's source dataset stores exactly one
(latitude, longitude)pair per heritage site record, even for serial/transnational properties spanning many countries and physical locations (seeworld_heritage_sitestable — singlelatitude/longitudecolumns). Per-image data (world_heritage_site_images) has nocountry_codecolumn, so there's no way to know which country a given image belongs to, or to pick an image consistent with a given coordinate (or vice versa).Suggested direction (needs a decision before implementing)
main_image_url/thumbnail selection logic to prefer an image known to be fromprimary_state_party_code. Coordinate itself stays as-is (still potentially "wrong" relative to the primary country, but at least the thumbnail and the country label agree).country_code(orstate_party_code) column toworld_heritage_site_images, and/or store per-sub-site coordinates for serial properties — then expose enough of that in the API response for the frontend to pick a coordinate/image pair that's mutually consistent.Acceptance Criteria
main_image_url/thumbnail and the country implied bylatitude/longitudeare consistent withprimary_state_party_codefor serial/transnational properties.Related: zigzagdev/world-heritage-frontend#387