For a full list of BASHing data blog posts see the index page.     RSS

The lat/lon floating point delusion

This morning I had a shower for 6.11686718 minutes. For breakfast I had 189.41576911 ml of fruit juice, followed by 75.24902503 g of muesli topped with 36.55668786 ml of milk and 15.44171338 g of yogurt.

Something wrong?

Maybe you think I'm a bit crazy — or at least very silly — to have so many decimal places in those numbers? Then how about the latitude/longitude of I Love Istanbul, one of my favourite eateries in Melbourne, Australia? According to the city's "Census of Land Use and Employment" in Melbourne's open data portal, ILI is at -37.80467681 144.9659498.

I've written before about too many lat/lon digits and so have many other people, including Randall Munroe in a recent xkcd webcomic. In Wikipedia there's a table explaining how the number of decimal places in a decimal-degree lat/lon relates to length. Following that table, ILI at 95 Lygon Street has been located ±0.55 mm in latitude and ±4.6 mm in longitude. Not bad for a property with a footprint maybe 20 x 20 m.

Popping those long coordinates into Google Earth, it looks like the georeferencing puts the point somewhere on ILI's back wall:


I can get the same position by rounding off the city's coordinates to 5 decimal places:


In fact, I can get a better location with just 4 decimal places, although that won't always be true for small properties:


The city of Melbourne isn't alone in over-stating the precision of its georeferencing. Most Australian governments do it. In an earlier BASHing data post I reported the georeferencing of suburbs by Logan City Council (Queensland) for their "Please remove dead animals" requests. The lat/lons are given to 15 decimal places, which is latitude to the nearest tenth of a nanometre, about half the diameter of a chlorine atom.

Commenting on that post on Hacker News, UK programmer Tom Anderson joked "No, no, i'm not calling about the dingo. There's a dead possum over on the other side of the chlorine atom."

I'd love to take one of the Melbourne data people aside for a quiet chat. They do a really fine job of making city data publicly available in a range of formats, and some of their spatial apps are gorgeous, like this major development mapper (click on a coloured building for details). But when it comes to lat/lons...

Look, I'd say, I don't mean to upset you, but you see these last few decimal places? They don't actually mean anything. I know you got them from The Computer, and The Computer doesn't lie, but sometimes... Well, it makes things up. It does this floating point calculation in its head, it works fine but it's kind of divorced from reality. How about you guys filtering what The Computer says?

The city of Melbourne, though, is way more sensible than the city of Sydney. On Sydney's open data portal, recreation centres (for example) are located to 12 or 13 decimal places (double-precision floating point?).

delusion4 delusion5

This is beyond silly. Publishing lat/lons with that many decimal places:

Sigh. I think I'll make myself a cup of coffee. Maybe a big one, 305.83640381 ml.

Last update: 2019-08-09
The blog posts on this website are licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License