hayley 365

home

leaflet - the mapping library I love to hate

10 Nov 2013

2013-11-10 22:52:37 -0600

Leaflet has undoubtedly made my life easier.

It's also made my life hell.

Specifically, any site that happens to serve both sides of the international dateline gets absolutely jacked up by the fact that leaflet has never come up with a way to handle the meridian properly.

Is it a hard problem to solve? I'm assuming so since it's been an issue since the beginning of time (or at least since the beginning of the leaflet library). But I've used Google Maps and Openlayers and both of them just worked. I didn't have to implement any magic to make things appear appropriately on both sides of the dateline.

If you do nothing, here's how the problem manifests:

Oh, you weren't actually expecting to see both sides of the dateline at the same time were you?

Finally disgusted by how ridiculous things looked any time spaghetti model paths, or heaven forbid, actual storm tracks crossed the dateline, I finally implemented an effing hack.

It continues to haunt me to this day when I find tiny little things that broke that I forgot about (since I now have to fudge all of the coordinates so that they show up where they're supposed to).

Leaflet has been awesome to work with otherwise. But this one tiny thing affects all but one of my sites that use maps.

I felt nothing but dirty when I implemented this hack and I shy away from the idea of doing this at all on any other site I have.

I really really really hope they fix at some point.

I'm not holding my breath.