@react-map-input/data-tr
v0.1.0
Published
Türkiye province (il) and district (ilçe) geopack for react-map-input.
Maintainers
Readme
@react-map-input/data-tr
Türkiye geopack for react-map-input —
81 provinces (il) and 973 districts (ilçe).
npm install react-map-input @react-map-input/data-trimport { GeoInput } from 'react-map-input';
import { turkey } from '@react-map-input/data-tr';
<GeoInput pack={turkey} name="serviceAreas" />;What is in it
Geometry is pre-projected at build time into one shared coordinate space (Albers conic equal-area, standard parallels 37.5°/40.5°), emitted as ready-to-render SVG path data. Nothing is projected in the browser.
| File | Size |
|---|---|
| regions.js — all 81 provinces | 149 KB raw · 59 KB gzipped |
| subregions/TR-xx.js — one province's districts | 2–19 KB raw, median 5.6 KB (~2 KB gzipped) |
| all districts together | 527 KB — never loaded at once |
Districts load lazily per province through a generated static import map, so bundlers code-split them automatically: opening İstanbul fetches 4 KB gzipped, not the whole country.
Geographic regions
The pack also carries the seven coğrafi bölgeler as turkey.groups, dissolved from the same
topology as the provinces so their borders follow province lines exactly:
| Region | English | Provinces | |---|---|---| | Akdeniz | Mediterranean | 8 | | Doğu Anadolu | Eastern Anatolia | 14 | | Ege | Aegean | 8 | | Güneydoğu Anadolu | Southeastern Anatolia | 9 | | İç Anadolu | Central Anatolia | 13 | | Karadeniz | Black Sea | 18 | | Marmara | Marmara | 11 |
Every province belongs to exactly one region, asserted by the build.
They are drawn as the outermost border level and are never selectable.
Region assignment comes from a reference table, not from provinces.json
The supplied region labels proved wrong for three provinces, so the assignment is taken from
source/region-reference.json — the 1941 Geography Congress classification, checked in as data.
The build logs every province where the two disagree, and fails if any province is missing from the
table or listed in two regions. The supplied files are never edited.
| Province | provinces.json says | Reference | Why the source is wrong |
|---|---|---|---|
| Bartın | North Sea | Black Sea | Disagreed with its own Turkish label and the other 17 Karadeniz provinces, producing a phantom eighth region. |
| Çankırı | Marmara | İç Anadolu | ~400 km from the Sea of Marmara; borders only İç Anadolu and Karadeniz provinces. |
| Hakkari | Güneydoğu Anadolu | Doğu Anadolu | Doğu Anadolu in the standard classification. |
A wrong region label is not a geometry error — it renders perfectly, just in the wrong colour — so
it needs its own check. An earlier heuristic asserted group cohesion (every region must have a
group-mate among its five nearest neighbours); it caught Çankırı but not Hakkari, which borders
Şırnak, genuinely Güneydoğu, so the wrong label still had a same-region neighbour. Only an explicit
reference table catches that class of error. Cohesion remains on as a second, independent check,
with an allowIsolatedRegions escape hatch for genuinely detached members.
Codes
Provinces use ISO 3166-2 (TR-34), districts are always region-scoped (TR-34-kadikoy).
Region-scoping is not cosmetic: 25 district names are reused across provinces and Merkez
appears 51 times, so a district can only be identified together with its province.
Attributes
turkey.regions[0].meta;
// { plateCode, population, areaKm2, altitudeM, phoneAreaCodes,
// isCoastal, isMetropolitan, region: { tr, en } }Useful with regionsWhere for bulk selection — 7 geographic regions, 28 coastal provinces,
30 metropolitan municipalities.
Source data
source/ holds the build-time inputs and is not published. The two upstream files contain no
geometry — they are the identity and validation layer that OpenStreetMap's polygons are matched
against. See source/README.md.
Rebuilding
npm run build:data # fetches ~16 MB of geodata on first run, then cachesMatch, simplify, dissolve, project, validate, emit — see CONTRIBUTING.md for what each step does.
The build fails rather than guessing: it must reproduce the canonical source exactly — 81
provinces, 973 districts, every per-province count matching stats.districtCount, and every
district matched to exactly one polygon. Adjust simplification with GEOPACK_SIMPLIFY=4%.
Licence
Geodata is ODbL 1.0 and requires attribution — see LICENSE and
ATTRIBUTION.md. The react-map-input component library is MIT and contains no
geodata, so share-alike does not reach your application code.
