Le petit monde de Freddy
I never thought that a relatively simple idea, and implementation, would engender so much work after effectively being put in to production. It caused me even more sleepless nights than my daughter. I’m talking about the We are the world to put the SDN world on a map.
What was going on? The first problem was that worldKit loaded the member point very slowly. And since people couldn’t see an immediate result they tended to submit their data repeatedly. So I needed to make some manual adjustments, with the risk that I was possibly overwriting data that was submitted during my intervention. Even after I’d fixed that problem by some fine tuning of the points loading, some people still continued to submit their data multiple times, even after my repeated remarks in the web log. So I put in additional warnings that appear in red when data is submitted. Even that didn’t seem to stop it from happening.
On top of that, it seemed that when different people gave the same location as being their residence, then only the latest entry was visible. The effect was that people thought that their original entry had been overwritten and resubmitted their data.
It wasn’t all doom and gloom though, I did have some warm and positive reactions. There were also tips for improvements and feature requests. I implemented the quick wins like the number of members registered.
The problem of the overlapping points intrigued me a lot. I’ve searched through the documentation without being able to find a solution. In some forums posts I found out that I wasn’t the only one with that problem. Since no solution was provided I mailed the author of worldKit directly, in order to found out if any progress had been made as regards this problem. Mikel Maron immediately (and most of all kindly) replied that this was indeed an issue that was still on the wish list. He advised me to put several people in one item. It isn’t such a bad idea, as such, but it entails more manual work, since it all resides in a flat XML file and maintaining this via a program would not be an efficient solution. The major drawback of this method was the fact that one could only link one Business Card to an item, which meant some trifling work with external links that would sum up all items with their own BC. Again, nothing that would be efficient enough.
Time for some change
So I needed to look for another solution. Valery had already mentioned Google Maps as a better option for the details which are non-existent in the worldKit implementation. So I started looking over there and from the very first moment I spotted a problem. Google maps don’t support GeoRSS, and the data that had already been collected was written in a flat file in that specific format. There was a hack though, written by Mikel Maron. Yes indeed, it’s the guy from worldKit. This extension would have been perfect if Google officially supported it. However, there was a risk that this wouldn’t be the case and that Google might choose another method, since the Mikel’s method required an extra proxy, due to security restriction of the browser.
Accordingly I now investigated Yahoo! Maps, which does support GeoRSS. It worked fine with a minimal amount of extra code. My joy was rather short lived though, since I spotted the same difficulty here as with worldKit. Identical locations are shown as one point, with a slightly thicker shadow. Yahoo! Maps are more detailed, although zooming in wouldn’t make much difference since it still remained a single spot. Back to the drawing-board. After spending a whole weekend trying out different things, like manually adding minor differences to the geocodes of those identical locations, I still hadn’t obtained any satisfactory results.
There was a ray of hope though. I did find an interesting map that could be the solution to my problem. This map had a legend. That meant that I could list all the members without hiding members with identical locations. It looks like a never ending story, but this solution also has its drawbacks. First of all, it’s not mine, thus I don’t have its functions, logo’s, advertisements and other layout related issues under my control. Secondly, it was made with Google. I didn’t want to change again since I had already invested much time in research on the Yahoo! version.
End of the tunnel
There was no need to despair though, since Yahoo kind of “supported” legend too, as long as one codes it by one’s self. This sneaker shop map was the best proof of this. There is one slight problem: it doesn’t work with GeoRSS. I had enough of all this and decided to leave the format and put everything in a database, in this case a small MySQL table. As a consequence a one-time manual conversion was required, but that’s peanuts compared to the effort I’d already put in. And I still didn’t have anything that worked.
I will spare you the rest of the problems – including the fact that my provider changed machinery and forgot to compile an essential element for the solution that I had in mind – and will show you some code instead. This is a developer’s network after all, isn’t it? Despite the huge interest in scripting these days, I won’t show you the rather workaday PHP (which took me a while, since I’m not a PHP expert :-() but rather the Yahoo! maps code. Many thanks to Valery Silaev for streamlining things.
For the map itself:
Create a map
var map = new YMap(document.getElementById('mapContainer'));
Determine a centre point
var myPoint = new YGeoPoint(30,10);
Zoom and centre the map
Add the Hybrid, Map and Sat Control
Add the slider zoom control
For putting the markers on the map:
Create a geopoint
var geopoint = new YGeoPoint(lat,lon);
Create the marker
var marker = new YMarker(geopoint);
Add the label to the marker (in this case the alphabetical place of the member)
Define the mouseover. It’ll show the name, country and BC, put in the balloon variable earlier.
Put it on the map
For the Legend:
Open the balloon for that specific marker for the mouseover.
It needs to be closed after the mouseover.
As you can see, things didn’t go as smoothly as they should have done. Despite all the hype, mapping software are still scarcely out of the egg, poorly documented and let one down when one wants to try the more advanced, and in my opinion, more obvious things. It took me a lot of effort to achieve this rather simple solution. I hope that this will encourage an even greater response and that you add your data to the SDN world map. For the moment, only 8.36% (67 to be exact) of the 798 readers of my We are the world web log have done this. The rest remain in hiding. No, I won’t start nagging about the involvement of the SDN community, but it’s still a long road ahead in order to prove to Freddy that we are 400K strong. Even the 4% participation rate, as mentioned by Mark Wipro passed 100K SDN Points. Congratulations., means a possible 16 000 people that could enter their data. So Brother and Sisters, Where Art Thou? Put yourself on the map!
Update: Version 3 of SDN World has been map released