This semester, the weather got nice just as we started exploring HTML5. I’d also noticed that about half my students had smart phones – the only reasonable thing to do was design a phone-based location logger lab. I had the students get things working inside and then they went out to collect data by walking around.
I had students form groups with people who had phones and author a HTML5/JS application that got the phone’s location using navigator.geolocation and post it to a PHP service every couple seconds. They hosted this in their public RPI webspace (so it was accessible by their phones).
The students retrieved their data during the next class and used it to generate a Google Map. What’d we learn?
- You must enable high accuracy in the HTML5 geo object if you want to visualize the data collected
You must to set the cache/timeout for geo object if you want to visualize the data collected - You should toss out any bad data before using it to construct a line as we’ve done below. Inspecting the geolocation’s accuracy property and only accepting points within a certain threshold is probably the way to go
- By default the iphone rejects cookies set by 3rd parties (the php webservice was setting a device ID in a cookie it set during an AJAX request … probably not the best)
Things look pretty noisy here: these points in town adjacent to campus are phones returning their location by IP or tower lookup rather than using the more expensive GPS look up.
Zoomed in, you can see lots of points in (well, almost in) our classroom in the Lally Building. Are all the phones wrong or did Google get the location of our building off by a few feet?
- Here is some data of a student walking along a road.


