Calibrating a map image: pixels, bounding boxes and the 50 km threshold
In Globdrop you click on a map, and the game tells you how far off you were and scores you on it. Two other posts cover the pieces that come before the score: how we make a map (the image and the calibration tool) and the six projections (the formulas). This one is about the numbers in a scenario file that turn a click into a distance, and a distance into points.
Five fields
Every map scenario in public/data/scenarios/ has these five fields next to its list of places:
| Field | What it is |
|---|---|
coordinateSystem | How positions are written and projected: Miller, LAEA, AlbersUSA, WGS84, UTM or Linear |
boundingBox | The coordinates of the image’s top-left and bottom-right corners, in that system |
distanceUnit | km or mi |
mapRealWidth | How wide the whole image is, in that unit. Only the maps that aren’t of the real world still use it |
maxDistance | The distance at which a click scores zero. It’s optional, and the default is 50 |
Here’s what they hold for a few scenarios:
| Scenario | System | Bounding box, left to right | mapRealWidth | maxDistance |
|---|---|---|---|---|
| Municipalities of Catalonia | UTM | 260,358 m to 560,000 m easting | 300 km | 50 km (default) |
| Capitals of Europe | LAEA | 44.4° W to 44.2° E | 4,500 km | 500 km |
| US States | AlbersUSA | 138.7° W to 74.7° W | 3,000 mi | 500 mi |
| World Capitals | Miller | 243.2° W to 261.6° E | 40,075 km | 2,000 km |
| Westeros | Linear | 0 to 1,000 units | 2,000 mi | 200 mi |
The world box isn’t a typo. It really spans about 505° of longitude, and we come back to that below.
From a click to a distance
The whole calculation is calculateDistance in src/engine/coordinate-math.ts:
export function calculateDistance(
userPixel: PixelPoint,
targetCoord: Point,
boundingBox: BoundingBox,
imageSize: ImageSize,
mapRealWidth: number,
coordSystem: CoordinateSystem = 'WGS84',
distanceUnit: DistanceUnit = 'km'
): number {
if (isGeographic(coordSystem)) {
const userCoord = pixelToCoord(userPixel, boundingBox, imageSize, coordSystem);
const km = haversineDistance(userCoord, targetCoord);
return distanceUnit === 'mi' ? km / KM_PER_MILE : km;
}
// UTM and Linear: one scale for the whole image
const targetPixel = coordToPixel(targetCoord, boundingBox, imageSize, coordSystem);
const pxDist = pixelDistance(userPixel, targetPixel);
return pixelDistToReal(pxDist, imageSize.width, mapRealWidth);
}
There are two paths.
- Maps of the real world (Miller, LAEA, AlbersUSA and WGS84) turn your click back into latitude and longitude with the inverse of the map’s projection, and measure the great-circle distance with the haversine formula, on a sphere of radius 6,371 km. The result is converted to miles on the US map. Here the distance doesn’t depend on the image’s scale at all.
- Catalonia (UTM) and the fictional maps (Linear) put the target on the image, measure the straight-line distance in pixels between it and your click, and multiply by
mapRealWidth / imageSize.width. One pixel is worth the same distance everywhere on the map. For UTM that’s accurate, because its coordinates are already metres on a flat grid. For the fictional maps there’s no real distance to be accurate to.
Until September 2026 only the ancient wonders took the first path. The next sections explain why that changed.
imageSize is the size of the image as drawn on your screen, not the size of the file. A miss of 40 pixels on a phone and 120 pixels on a desktop monitor come out as the same distance.

From a distance to points
calculatePoints in src/engine/scoring.ts gives zero if the distance is at or beyond maxDistance, or if time is up. Otherwise it multiplies a time factor, (seconds left + 1) / 2, by a precision score that falls linearly from 100 at the target to 0 at the threshold. With 10 seconds left and a perfect click, that’s 5.5 × 100 = 550 points, and one of the Vitest tests checks exactly that number.
The thresholds follow the size of the map: 50 km for Catalonia, 500 km for Europe and the ancient wonders, 500 mi for the United States, 2,000 km for the world, and 100 or 200 mi for the fictional maps. Designing Globdrop’s feedback loop covers how that feels from the player’s side.
Where 50 km came from
Globdrop grew out of an older game that only had one map, Catalonia. A comment in scoring.ts keeps its formula: points = ((count+1)/2) * (50 - dist) * 2. The 50 there is kilometres, and the design notes in the repo record the same Catalan bounding box, 260,358.2 to 560,000 m easting, that the scenario file uses now.
When the formula was generalised to many maps, the 50 became the default for maxDistance, and it’s still what applies when a scenario doesn’t set one. Only Catalonia relies on it. On a map 300 km wide, 50 km is a sixth of the width.
Catalonia is also the scenario whose scale is the easiest to check. The bounding box is 299,642 m wide and mapRealWidth says 300 km, so the pixel scale matches the UTM coordinates to within 0.2%.
The world maps and the Equator
This section describes the game as it was until September 2026, when every real-world map still took the pixel path.
For the five world scenarios mapRealWidth is 40,075 km, the length of the Equator. The intent is clear: set the scale so that the width of the image equals one trip around the Earth at the Equator.
The image isn’t one trip around the Earth, though. The world SVG has a wide margin around the map, and the calibrated bounding box, fitted to where places actually appear, runs from 243.2° W to 261.6° E. That’s 505° of longitude, not 360°. With 40,075 km spread over 505°, each degree at the Equator counts as about 79 km, where the real value is 111 km.
We ran the game’s functions of that time on a few pairs of capitals and compared the result with the great-circle distance:
| Scenario | Pair | Globdrop | Great circle | Ratio |
|---|---|---|---|---|
| World Capitals | Quito – Manaus (near the Equator) | 1,485 km | 2,076 km | 0.72 |
| World Capitals | Nairobi – Kampala (near the Equator) | 364 km | 505 km | 0.72 |
| World Capitals | Paris – Berlin (49–53° N) | 968 km | 877 km | 1.10 |
| World Capitals | Oslo – Helsinki (60° N) | 1,127 km | 787 km | 1.43 |
| Capitals of Europe | Paris – Berlin | 748 km | 877 km | 0.85 |
| Capitals of Europe | Lisbon – Moscow | 3,326 km | 3,906 km | 0.85 |
| US States | San Francisco – New York | 2,231 mi | 2,566 mi | 0.87 |
| Ancient wonders | Giza – Rhodes | 768 km | 768 km | 1.00 |
Two things are going on in the world rows. Near the Equator, the scale error makes every miss look about 28% shorter than it is. Further north, Miller’s stretching pulls the other way: the projection makes east–west distances longer as you leave the Equator, and a fixed pixel scale doesn’t correct for it. At 60° N the two effects add up, and an east–west miss looks 43% longer than it is. So a 2,000 km threshold works like about 2,800 km in Ecuador or Kenya and about 1,400 km in Scandinavia.
Europe and the United States are more uniform across the map, but both scales run short, by about 10–15% in the pairs we tried. The ancient wonders, measured on the sphere, match exactly.
It didn’t break the game: everyone playing a scenario got the same scale, so scores compared fairly between players. But a capital near the Equator was easier to score on than one in Scandinavia, and the distance shown after a click wasn’t the real distance, except on the ancient wonders and, very nearly, Catalonia.
There’s a smaller inconsistency that is still there. Each world scenario was calibrated separately, and their bounding boxes differ by a few degrees (Greatest Peaks spans 512°, Sports Stadiums 502°) although they share the same image. So the same longitude and latitude lands on a slightly different pixel in each of them, by up to about 2% of the image width. Since the change below it only moves where the target pin is drawn, not how the distance is measured.
What we changed
We had two options for the world maps: set mapRealWidth from each bounding box (about 56,200 km for World Capitals), or measure on the sphere. A better width would have fixed the Equator and left the 60° error, because no single scale fits a Miller map. So every map of the real world now goes through the inverse projection and the haversine formula, as the ancient wonders already did. The same pair of capitals now gives the great-circle distance on any of those maps, and the threshold means the same distance in Ecuador and in Norway.
This changed scores. On the world maps, misses near the Equator now count about 40% longer than before and misses in the far north shorter; on Europe and the US, all misses count 15–20% longer. A test in the game’s repo checks the Equator case: a click 10° of longitude from the target scores 1,112 km.
The same change fixed the unit. distanceUnit used to be in every file and read by no code, so the US map and the three fictional maps showed miles labelled “km”. Now the distance is computed in the scenario’s unit, and the line after a click, the results screen and the share message say “mi” on those maps.
Still to do: give the five world scenarios one shared bounding box.
For the strategy side of thresholds, what distance to aim for on each map, see the strategy guide.