Skip to content

shadcn.io is an independent project built on shadcn/ui

True Size Map Block for Ark UI

Drag a copy of a country across a live Mercator map to see its true size. It shrinks toward the equator and swells toward the poles.

On this page5 sections

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show how the map lies about size, with this true size map for React with Ark UI. Spherewise, a geography classroom tool, puts eight countries' outlines on a live Map that follows your theme, light or dark, and like almost every web map it uses Mercator, which stretches every place by its latitude. Choose a country in the card and a copy of its outline lands away from home: Greenland over Central Africa to begin with, Australia over the United States, India over European Russia. Drag the copy by the pin standing on its middle, or focus the pin and use the arrow keys, and it is redrawn at every step by turning the globe under it, so it keeps its true size and shape while the map stretches it as it would stretch anything there: it shrinks toward the equator and swells toward the poles. Its home stays as a dashed outline, so the two can be compared at a glance. The card ranks the eight by true area, with a bar for each, and reads how many times its true area the map draws the copy where it is and at home; Equator and Put back move it in one press. Built from Map, Button and Guides. For geography lessons, explainers, data journalism and anyone who still thinks Greenland is the size of Africa.

FAQ

How does the outline keep its true size?

Each corner of the outline is turned into a point on a sphere and carried with the globe: turned so the country's middle sits on the prime meridian, rolled north or south along it to the new latitude, then turned to the new longitude. On the sphere that changes nothing about the shape or the size; the map then draws the moved corners in Mercator, which stretches them for where they now are. Rolling along a meridian keeps the country's north pointing north, as the familiar true size tools do.

What do the two figures in the card mean?

How many times its true area the map draws a place at that latitude: Mercator stretches lengths by one over the cosine of the latitude, so areas by its square. On the equator that's 1.0; at Greenland's middle, near 75 degrees north, it's about 15. The first figure, Stretch here, follows the copy's pin as you drag it; the second is for the country's middle at home.

Where do the outlines and areas come from?

The outlines are Natural Earth's small-scale country borders, the main landmass of each, simplified to a few dozen corners and typed into the file. The areas are each country's official total, inland water included, so they run a little larger than the simplified outline. Nothing is fetched but the map's tiles.

Why does the copy stop short of the poles?

Mercator can't draw a pole: it would be infinitely far up. Each time the copy moves, the block checks that every corner stays within 84 degrees of the equator and that the outline doesn't wrap round a pole; if it would, the copy stops as far toward the pole as it fits. Russia, the widest, can only go a few degrees further north than its home.

Can I move it without a mouse?

Yes. The pin is a draggable marker: focus it and the arrow keys move it ten pixels at a time, forty with Shift. The countries in the card are buttons that choose, and Equator and Put back move the copy in one press; the zoom buttons work too. A polite message reads where the copy is and both figures once it settles.

How does it look on a phone?

The map comes first with the copy, its home and the pin, and the card docks under it with the eight countries, the two figures and the two buttons. On large screens the card floats over the map's start and the camera keeps both outlines clear of it. Drag the pin with one finger; two fingers pan the map.