Figure

5 of 400 nearest-neighbour queries change answer in the plane

Drawn here at the parameters it defaults to, with every essay that calls it.
5 of 400 nearest-neighbour queries change answer in the plane. 40 sites and 400 queries over -20° to 40° east and 35° to 70° north, each query answered twice — once by geodesic distance and once by straight-line distance in the stored plane. They agree 98.8 per cent of the time, which is why the operation survives, and the 5 that differ are marked. The mechanism is not that the plane is wrong by a lot but that its scale factor varies: over this region it spans 139 per cent, and every disagreement is a contest closer than that — the worst margin measured is 6.4 per cent. The furthest a wrong answer is from the right one is 24 kilometres.

40 sites and 400 queries over -20° to 40° east and 35° to 70° north, each query answered twice — once by geodesic distance and once by straight-line distance in the stored plane. They agree 98.8 per cent of the time, which is why the operation survives, and the 5 that differ are marked. The mechanism is not that the plane is wrong by a lot but that its scale factor *varies*: over this region it spans 139 per cent, and every disagreement is a contest closer than that — the worst margin measured is 6.4 per cent. The furthest a wrong answer is from the right one is 24 kilometres.

It is drawn by operation-figure with show: "nearest-query" — one member of a family of 14 figures that share a generator, so the drawing above is what that generator returns when it is asked for this one and given nothing else.

6 essays call it. Every call below passes it something, because a placement that passes nothing draws whichever member of the family the generator happens to default to rather than the one its essay argues about.

Where it is called

Changing this changes every one of these figures.

"Within 0.01°" on the ground, at five latitudes. The same condition drawn at five latitudes, all at one scale. A degree of latitude is a fixed distance — 1106 metres here, varying by less than one per cent from equator to pole — while a degree of longitude collapses as cos φ, from 1113 metres to 289 at 75°. So the "circle" is an ellipse of 3.86:1 there, and it encloses 26 per cent of the ground the same condition covers on the equator. Even on the equator it is not round: M is smaller than N by the flattening, so the shape is 6694 parts per million shorter north–south than east–west. What a machine does with it

A degree is not a unit of length

"Within 0.01 degrees" is a condition anybody can write and no instrument can measure. On the ground it is an ellipse — 1,106 metres north–south and 558 east–west at 60° — and even on the equator it is not a circle, because the meridian's radius of curvature is smaller than the parallel's by the flattening.

A 20° shape across the antimeridian, in the space where the numbers live. Longitude runs across the page from −180° to 180°, which is where the failure is: the shape is one rectangle on the ground and two pieces in the numbering, and every operation that treats longitude as a real number sees the two. The bounding box comes out 359° wide instead of 20°, the planar area comes out 17 times too large because the shoelace encloses the complement, and the midpoint of a segment from one edge to the other lands 20015 kilometres away — the antipode of where it belongs. The true area, from the closed form, is 4,920,667 square kilometres. What a machine does with it

The antimeridian is a cut in the numbers

A twenty-degree box across 180° has a bounding box of 359.4°, a planar area seventeen times too large, and a midpoint 20,015 kilometres from where it belongs — which is the antipode, exactly. Moving the cut moves the failure and never removes it, because a circle cannot be numbered by an interval.

5 of 400 nearest-neighbour queries change answer in the plane. 40 sites and 400 queries over -20° to 40° east and 35° to 70° north, each query answered twice — once by geodesic distance and once by straight-line distance in the stored plane. They agree 98.8 per cent of the time, which is why the operation survives, and the 5 that differ are marked. The mechanism is not that the plane is wrong by a lot but that its scale factor varies: over this region it spans 139 per cent, and every disagreement is a contest closer than that — the worst margin measured is 6.4 per cent. The furthest a wrong answer is from the right one is 24 kilometres. What a machine does with it

Nearest is a question about the metric

Asked in the plane the data is stored in, a nearest-neighbour query returns a different site for 5 of 400 queries over Europe on Web Mercator — and 103 of 400 on the plate carrée, with the wrong answer up to 309 kilometres further away. Every disagreement is a contest closer than the region's own scale spread, and over a city there are none.

five planes a dataset might be stored in, scored on three operations. Each candidate measured over -10° to 30° east and 35° to 60° north: the worst areal error, the worst angular deformation, and the spread of the scale factor, which are what an area query, a shape and a distance respectively depend on. The best plane for areas is Gall–Peters, for shapes Lambert conformal conic, and for distances Lambert conformal conic — three different answers, and no fourth candidate would collapse them, because a projection exact in two of these columns has a = b = 1 everywhere and is the isometry Gauss's theorem forbids. area of a polygon costs 3.06× too large in the wrong plane; drawing a line between two points costs 194 km from the ground it claims. What a machine does with it

The operation decides the coordinate system

Five candidate planes over one region, scored on the three things a spatial operation depends on. The conformal conic wins shape and distance and is 11.7 per cent out on area; the equal-area member is exact on area and 38.9° out on shape. No candidate is exact in two columns, and no candidate ever will be, because one that was would be an isometry.

The query, the box it becomes, and the 14 per cent it loses. A query for everything within 400 kilometres of a place at 55° north, drawn in the stored coordinates of Web Mercator. The ring is the true answer's edge; the rectangle is the box the index is given, sized from the scale factor at the query point. The arcs outside the rectangle are true neighbours the index never returns — 13.6 per cent of the rim, reaching 5.0 per cent of the box's own half-width beyond it — and nothing downstream can tell they are missing. What a machine does with it

The query a fast path actually answers

Fifteen rungs price what a stored coordinate means and none asks what it is searched with. No index answers "within two hundred kilometres of here"; an index answers "inside this rectangle of stored coordinates", and the rectangle is built by somebody's arithmetic — which at 55° north silently drops a tenth of the true answer on a conformal projection and three fifths of it on an equal-area one.

One rule, applied once, to one dataset. Two features 3 metres apart on the ground, and a snapping tolerance of 5 map units on Web Mercator. The tolerance's reach is the curve; the pair's separation is the line. They merge everywhere below about 52.8° and stay separate above it — the same features, the same rule, the same run. A pipeline that cleans a global dataset in one pass produces a topology that changes at a latitude nobody chose and nothing records. What a machine does with it

A tolerance in map units is not a tolerance

A snapping tolerance is a number, and the number is in whatever units the file is in. Five map units on Web Mercator is 4.97 metres of ground at the equator and 0.87 at eighty degrees — so a rule that merges two features three metres apart merges them everywhere below 52.8° north and refuses everywhere above it, in one pass, over one dataset, with nothing recording where the boundary is.

The whole library