Posts tagged ‘goecoding’

Auto seeding of lat/lng

I’ve added a new function to BuddyXML so that users who have never logged in to the maps (or MSG) still get their latitude and longitude recorded in the Wildfire database. Previously only users who had visited the maps page and had confirmed their location who appear as markers on the map. This means that for the first few users, very few people would appear on the map. To get around this I’ve updated the replication script so when a new user is added to Wildfire (during the process which replicates with the Moodle database) the Geonames webservice is called to try and determine their lat/lng based on the town and country entered in Moodle.

This appears to be working quite well, I have a list (anonymised) of the ‘real’ locations users have entered in OpenLearn and have tested seeding the Wildfire database with these and getting their lat/lngs. I know it’s not going to be 100% accurate, for example, if there is more than one result for a given location, then my script will just pick the first one – but users can always update their location when they log in if it’s incorrect.

I tested this by adding a few hundred users to my test courses then logging in to my MSG maps page – it all ran ok-ish (i.e. got the seeded locations for users where possible) but the main problem was the page running really slowly – due to the number of users. So I’m going to need to look again at how to make my javascript more efficient, I found this page which seems to have some good tips and I’m going to get to grips with how Firebug can track bottlenecks in javascript code – I’m assuming that it can!