Oooh Lambert

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:

X: 65591.206
Y: 171629.285

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

– Pieter

7 comments

  1. trouble

    When I briefly spent some time at an unnamed public transport company in Brussels (it wasn’t the NMBS – and I wasn’t involved with “data”) I also had some fun with Lambert projections.

    They’re quite interesting mathematically in fact. Projections in general are. And they all have benefits and drawbacks.

    The main benefit of Lambert projections is that they preserve areas (at the cost of angles), which makes a lot of sense if you’re trying to calculate distances (the maths are a lot easier). Since most calculations involving maps tend to be most interested ultimately in distances, having a projection that preserves them is very handy.

    Note that Belgium isn’t alone in using Lambert projections. It’s a widely accepted projection.

    I agree with you that the not-quite-spherical nature of the Earth can be inconvenient. But projections are lots of fun, trust me. If you get bored with them, you should look at immersions.😉

  2. trouble

    Oh – on the GRS80 ellipsoid bit: that just means that Lambert2008 coordinates can be directly converted to GPS coordinates with a simple “projection” (yes indeed) instead of a complicated transformation.

    If you wanted to convert GPS coordinates to Lambert1972 or vice versa, as you discovered, you had to do a really annoying transformation (the NGI site links to the maths for you). This is computationally un-fun.

    Also note that if you study Lambert1972 and Lambert2008 for a bit, you’ll find that it’s trivial to distinguish between them.🙂 Exercise for the reader…

  3. Emelie

    If you want comments you can get them: don’t start a sentence with ‘which’. Besides you should make up your mind if you want to use ‘railway company’ or ‘railwaycompany’, personally I’d suggest the former (same for bus and subway companies). To conclude I would like mention that I prefer to use/read/hear ‘any comments’instead of ‘any comment’ and though I don’t have the proof (so I might as well be wrong) I believe the latter is grammatically incorrect. Happy?

    • trouble

      Emelie: I’m glad that I’m not the only (part-time) English language pedant reading along.🙂

      Your belief regarding “any comment” is wrong though. I checked in the OED to be sure.

      “Any” can be either singular or plural. In the singular it refers to “a something, no matter which” or “whatever quantity of something” and in the plural to “some somethings, no matter how many somethings”.

      I agree that it is probably more common to write “any comments” than “any comment” however.🙂

      • Emelie

        Told you I could be wrong (: (I blame it on my inexperience and the fact that I am human) nice to know the truth though

      • pietercolpaert

        Ha! Thanks for the suggestions. Maybe I should turn my blog into a wiki where everyone can add their spelling notes and grammar suggestions😉

        (for the record: I’ve asked Emelie to do this. She won’t correct you this rude in real life. I hope. ;))

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s