Around the World (Around the World)

Sandra has ongoing issues. When we last checked in, we had some problems with geography, and those problems haven't been solved.

Now, one truth of geographic points is that they're bounded. We know, for example, that longitudes cover the range (-180,180), and latitudes are always (-90,90). Even if we change the coordinate system, it will still have bounds, as the Earth is a closed shape with finite boundaries.

Sandra maintains an application that lets users annotate the map with their own data points, drawing shapes on the map and recording the coordinates of the shape. The code which manages the map layer allows the user to pan around the map, and transparently update its internal coordinates to remain within those boundaries. The code which manages the annotation layer, however, does not. It will happily let you draw a shape on New Zealand, and the coordinates might be 177 degrees, -183 degrees, or even -543 degrees. It doesn't care.

Now, when exporting this data, this turns out not to be a problem. Other mapping tools will receive a wildly out of bounds coordinate and shift it into the valid range- a safe and non-destructive operation.

But when rendering the data, it turns out, it's a problem. The annotation layer isn't smart enough to do that shifting, so if you scroll around the map a few times, and draw a shape on New Zealand at, say, -543 degrees, the next time you load the data and scroll to New Zealand- your annotations aren't there. But if you rotate around the Earth a few times, like Superman reversing time, the annotations will pop up.

The end result is a lot of very confused users, and a lot of support tickets that basically amount to "you rotated the Earth wrong, try again".

The fix would be some relatively simple math, but as is frequently with the case with these things, the annotation layer code is a mass of ugly spaghetti and every change is fraught with risk. There are also a million other things on fire, which means, "users get confused but their data still exists" places it on the absolute lowest priority. So the tickets keep coming, the users keep getting unsatisfactory workarounds, the world keeps spinning, and nothing ever changes.

[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

This post originally appeared on The Daily WTF.

Leave a Reply

Your email address will not be published. Required fields are marked *