@abez/turkmenistan-map
v0.1.1
Published
Customizable, accessible SVG map of Turkmenistan for React -- regions and districts, built-in metadata, choropleth, tooltips, and drill-down. Zero runtime dependencies.
Maintainers
Readme
@abez/turkmenistan-map
A customizable, accessible SVG map of Turkmenistan for React — 5 top-level regions and 59 districts, geometry from geoBoundaries, choropleth, drill-down, and 3-locale built-in metadata (tk/ru/en).
Built on @abez/map-core,
the shared engine also powering @abez/kazakhstan-map
and @abez/uzb-map.
TypeScript-first. Zero runtime dependencies.
Ashgabat is not on this map. geoBoundaries' current Turkmenistan release has no polygon for the capital city at all -- not at the region level or the district level. Every other current region/district is present. See
DATA_SOURCES.mdfor the full writeup.
Install
npm install @abez/turkmenistan-mapReact 17+ is a peer dependency; nothing else is required at runtime.
Quick start
import { TurkmenistanMap } from '@abez/turkmenistan-map'
export function App() {
return <TurkmenistanMap locale="en" onRegionClick={(code) => console.log(code)} />
}Choropleth
<TurkmenistanMap data={{ 'TM-A': 90, 'TM-M': 80, 'TM-B': 55 }} />Keys are region codes ("TM-A") or, in view="districts", district codes.
Drill-down
const [focusRegion, setFocusRegion] = useState<string>()
<TurkmenistanMap
focusRegion={focusRegion}
onRegionClick={(code) => setFocusRegion(code)}
onDistrictClick={(code) => console.log('district', code)}
/>Custom markers
import { TurkmenistanMap, useProjectPoint, useMapScale } from '@abez/turkmenistan-map'
function CapitalMarker() {
const project = useProjectPoint()
const scale = useMapScale()
const [x, y] = project([63.5763, 39.0797]) // Mary
return <circle cx={x} cy={y} r={4 / scale} fill="red" />
}
<TurkmenistanMap>
<CapitalMarker />
</TurkmenistanMap>Locales & metadata
import { getRegionMeta, getDistrictsByRegion } from '@abez/turkmenistan-map'
getRegionMeta('TM-M') // { code, names: {tk,ru,en}, capital, population, populationYear, areaKm2, ... }
getDistrictsByRegion('TM-M')District-level population/areaKm2 are best-effort -- 33 of 59 districts
have both confirmed (verified: true), notably higher coverage than this
monorepo's other country packages thanks to an unusually complete current
Wikipedia source table. See DATA_SOURCES.md for exactly what's confirmed
vs. estimated vs. genuinely unknown (12 districts have no name at all in
the source data).
Data & attribution
Geometry derived from geoBoundaries TKM
ADM1/ADM2 (Runfola et al. 2020). See DATA_SOURCES.md for full
attribution, the Ashgabat gap, and the unnamed-district placeholders.
