mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 00:02:25 +00:00
Bundle Wikidata cities for offline place lookups
A pack of the world's settlements of 15,000 people or more (31,827 places,
1.6 MB, CC0) built from the Wikidata Query Service by
scripts/build-wikidata-cities.mjs. src/data/wikidataCities.js reads it on the
first lookup and answers the nearest city to a point, the cities around it,
a city by name ("Paris, France", or the nearest namesake in view) and a
country's name in the page language. Names match without accents or case.
The build leaves out groupings of settlements (metropolitan areas,
agglomerations) and places that no longer stand, keeps a city that is also a
narrower grouping kind (Istanbul) or a unit dissolved where nothing else
names the spot (the Vietnamese provincial cities of 2025), fills a country
from the area a place lies in, splits a population band the service cannot
answer in time, and fails if well-known cities are missing or a known
grouping gets in. The app never calls Wikidata itself.
Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
c2e42b5dfd
commit
1dc5a67518
8 files changed
+891
-1
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# Wikidata cities pack
|
||||
|
||||
World cities and towns for naming a spot (the nearest city), the places
|
||||
around it and finding a place by name, read by `src/data/wikidataCities.js`. The app reads this file; it
|
||||
does not call Wikidata or any place service for these.
|
||||
|
||||
| File | Contents |
|
||||
|------|----------|
|
||||
| `cities.json` | Human settlements with coordinates and a population at or above the cut-off (see `meta.minPopulation`), largest first |
|
||||
|
||||
Each row is `[name, lat, lon, population, country, wikidata]`: the English
|
||||
label, coordinates to three decimals, the largest stated population, the
|
||||
ISO 3166-1 alpha-2 country code (empty when Wikidata gives none) and the
|
||||
Wikidata id.
|
||||
|
||||
**Source:** Wikidata, read once from the Wikidata Query Service by
|
||||
`scripts/build-wikidata-cities.mjs`. The build time and row count are in the
|
||||
file's `meta` header.
|
||||
|
||||
**License:** CC0 1.0 (https://www.wikidata.org/wiki/Wikidata:Licensing). No
|
||||
attribution is legally required.
|
||||
|
||||
**What is left out:** metropolitan areas, urban agglomerations, conurbations
|
||||
and similar groupings of settlements, so a view is named after the city
|
||||
rather than the area around it (an item of a narrower grouping kind that is
|
||||
also a city stays: Istanbul is a metropolitan municipality and a megacity);
|
||||
places that no longer stand (former entities, ghost towns, abandoned
|
||||
villages, archaeological sites) unless they are also a living settlement;
|
||||
and places Wikidata states as dissolved or abolished (P576) where another
|
||||
place within 15 km still names the spot. A dissolved unit with nothing
|
||||
else near it stays: many of Vietnam's provincial cities ended as units in
|
||||
2025 and still stand under their names. Also left out: places below the population cut-off and
|
||||
places without an English label.
|
||||
|
||||
**Rebuild:** `node scripts/build-wikidata-cities.mjs [--min-population 15000]`.
|
||||
The build runs one query at a time with pauses and honours the service's
|
||||
Retry-After; it takes about ten minutes. It fails if a short list of
|
||||
well-known cities is missing from the result, or a known grouping gets in.
|
||||
|
||||
**Limits:** populations are whatever Wikidata states and differ in date and
|
||||
definition between places (city proper, municipality, urban district). Some
|
||||
districts and suburbs appear as their own rows.
|
||||
Reference in new issue
Block a user