I remember the sixth of December 1997 as the day I got to know how to read a map. A holy man came into my house, or that’s what I believed according to the legend of Saint Nicholas, and dropped an atlas and a globe on the couch. That day, I learned the capitals of some countries you wouldn’t have heard of in a million years (probably you have now, thank you Geo Challenge) and most importantly, I learned how to interpret coordinates! I spun the globe around and where it stopped I had to look up the details in the atlas. What a joyful way to spend time without social media around, just yet.
We’re 10 years later. Google has just released Google Earth and to my great pleasure I had a much better globe and atlas in one single program. For old times’ sake I flung my globe, that was after all these years still standing next to me on my desk, and chose a random coordinate, put it in Google Earth and… guess what… it worked!
Today, 2011, I’m an open data enthusiast and so much more. I’m working on the iRail project. The project aims at creating a general webservice for public transport in Europe. At this moment it works for the Belgian railway company and we’re working on support for the Dutch railway company and Belgian bus- and subwaycompanies. It’s the latter that made me feel very insecure.
The result of 100 lines of code (maps.irail.be)
This site let’s you convert an address into coordinates. An incredible tool for location-based open data! In the end an end-user doesn’t want to query on coordinates, but on an address. Let’s turn this tool into a webservice right? We scraped the NMBS (Belgian railwaycompany) before so this will be easy! At least, that’s what I though this morning. Today, in my breaks from studying of course, I have spent my time figuring out what these X/Y-coordinates meant:
As this site is hardly documented I started googling what they could mean. On a very Belgian-looking (this is not a compliment) website I’ve found documentation: check it out for yourself. Apparently for some reason, please someone tell me why, Belgium started to use its own “Lambert projection” which uses the Hayford1924 ellipsoid. Too complicated? Well, not yet… It seems that this Lambert 1972 projection didn’t do the trick anymore and everyone was in need for a better, Lambert 2005 projection. Which was a lot better because in 2008 they decided to change this projection into Lambert 2008, which was not that bad because if you wanted to use 2008 instead of 2005 you only had to add 499 000m to each coordinate. This is a good thing because now the Lambert 2008 projection uses the GRS80 ellipsoid. Get it? Me neither. In fact, it feels like filling out my tax bill for the first time all over again.
Of course this had some implications since software that supported this projection became confused. They didn’t know what kind of Lambert they implemented and as a result showed wrong locations (typically exactly 1km off: the 1972 – 2005 problem). In fact I’ve had a hard time today writing a function, because there were no ready-made functions out there and because apparently the math is not that easy. If anyone would stumble upon this problem, the PHP code for the Lambert 1972 projection can be found HERE. You hereby get my permission to steal this “tools” class and reuse it elsewhere (WTFPL).
Is there someone who can tell me more about why Belgium is so keen on the Lambert projection? It is used by a lot of Belgian instances and I figured there most be some benefits over the WGS84 standard, which we have all learned as a kid: longitude & latitude… Any comment welcome