defuss-shadcn / Geography / geography
Geography
One component and the library it is made of. The Geo Map draws Natural Earth's countries, continents and first-order regions in SVG on five projections: a click picks a region, a search or a double click frames one and shows its children - Europe its countries, Germany its states - and callouts name every region in view outside the map. Under it, df$.shadcn.geo measures GPS distances on the WGS84 ellipsoid, addresses the globe in S2 cells and finds routes over segments you supply.
On this page (3)
§An atlas
Search a continent, a country or a state - Enter frames it and shows what it holds. Double click a country to drill down, Up steps out, a click picks a region. Callouts name everything in view.
§What is in it
| Page | What it covers |
|---|---|
| Geo Map | The component: projections, levels, palettes, borders, layers, its State API and API |
| Regions & Selection | Picking one or several regions, the four highlight styles, the hover lift, choropleth styles |
| Search & Focus | Search by name, framing a region with its children, drilling down and stepping out |
| Callouts | A leader line from every region in view to its name outside the map |
| GPS & Geodesy | Distances, bearings and geodesic lines on the WGS84 ellipsoid (GeographicLib) |
| S2 Cells | Cells from GPS positions, tokens and exact ids, neighbors, parents and children |
| Routing | Shortest routes over supplied segment lengths, positions inside segments, a Morton index |
| Data & Encoding | The Natural Earth data, its levels of detail, the DGEO format, your own GeoJSON |
§What it costs
The component ships its own code only - the projections and paths (d3-geo with its d3-array helpers), the ellipsoidal geodesics (GeographicLib) and the data's metadata format (defuss-dson) load from their pinned official builds with the first map on a page, about 90 KB minified. S2, the Morton index, the routing and the data decoder are the component's own. The data loads by need: a 97 KB world overview first, a country's detail and its states once they come into view.
Everything is generalized boundary data at atlas scale: Natural Earth v5.1.2, public domain. A "state" is Natural Earth's first administrative level - a German Land, a French region or department, a US state - not a uniform political category; these are not street or cadastral boundaries.
Comments, ideas or improvements? Edit this page's source on GitHub