eneylon

Archive for March, 2010|Monthly archive page

Hacking Sunrise

In general on March 15, 2010 at 9:51 pm

Sunrise is my hack from wherecamp.eu.

It’s a calculator of sunrise and sunset times that can be used to build location-based applications. Potential users of such applications are anyone needing to know when surise or sunset will occur at their location – or another specified location. This could be photographers wanting to capture landscapes bathed in colour, farmers who wake a specified time before sunrise (if farmers still do that), religious observers with dietary or worship practices based on sunrise or sunset, etc.

Timings are calculated using an algorithm from the Almanac for Computers, 1990, published by Nautical Almanac Office, United States Naval Observatory. It makes sense to use an approach driven from a need for precision informtion so this seemed a good starting point. Implementation in code was trickier than originally thought because the trignomatric functions need converting between degrees and radians – fortunately there is a worked example available which also led to the discovery of an an error in the algorithm. Additionally there is the need to account for step changes in time zones when factoring in summer time.

The hack took this data and cycled through the days of the year. For each returned value a line was drawn on an SVG canvas – showing the variation across the year. Near the equator this variation is minimal (the days tend to be around 12 hours), but once we deviate into seasonally-affected areas the utility of knowing each days twilight tmes becomes more apparent.

The calculator source code is posted on github and I welcome implementations in other languages, extensions and improvements. If you would like to get involved ping me on twitter where my username is eneylon. Next steps on this are to figure how could the latitude and longitude can be retrieved: they could be provided by the application, entered into a web form, supplied from gps access, or accessed with a javascript library. There is also more work needed on calculating summer time change dates.

Unfortunately I’m not patient enough to be a graphic designer – so to move this forward it would be good to work with someone skilled in design to collaborate on rendition of an attractive interface to the data.

Advertisements

More WhereCamp.eu

In meetings on March 14, 2010 at 8:45 am

On the second day of WhereCamp.eu we moved to the luxurious Guardian offices in Kings Cross. There were fewer attendees in a much larger space, giving the event a distinctly different feeling.

At the start of the day I met up with a former colleague who was going to the open source in geographic information systems session. So I followed him. The session was about the organizational support provided by the Open Source Geospatial Foundation. A theme that came across, and echoed from yesterday’s sessions, was the problems with open source tools being focussed on the needs of developers, rather than the needs of users – although there is optimism that the Quantum GIS project may be addressing this issue.

Then there was a session about using historical data. It was led by Peter Miller from ITO – whose colleague impressed enough the previous day to make his affiliation on the wall enough to convince me to attend. The pitch was to initiate a project to make current and future data better quality. Using the example of high speed rail planning. We were shown currently available consultation data and invited to think about the social consequences of poor quality data locked in PDF documents. The discussion focussed around the idea of time-travel and there was some serious scope creep from the initial concept. Peter proposed turning historical and current images into data – extrapolating backwards in order to improve the tools to plan ahead. As he said: “getting people who are excited about the past makes the tooling much better for planning the future”. The session concluded with a group of highly motivated people agreeeing to work on a project to create a 1921 version of the rail network on Open Street Map – a good result for a well-prepared pitch.

The last session before lunch was about accessing location based services on the iphone. Tom Melamed took us through various ways to simplify writing an application using wrapping technologies. Contending that the best way to develop an iphone application is to write a web page, Tom first presented the W3C geolocation specification and demoed how a mobile accessed webpage can ask a browser to provide location. He went on to show PhoneGap – a wrapper around a webpage delivered as an application (needs a mac to use). Another solution to this is titanium (and there are several others providing similar Objective-C avoiding solutions). Another useful tool mentioned was jQTouch – a javascript user interface library that makes web pages look and feel like iphone apps. It can be combined with phonegap to build apps – phonegap apps are allowed on the app store (and it also works on android).

After lunch was spent watching the rugby international; and chatting to others who were torn over their priorities. As the closing session and hack review overlapped the last 20 minutes of the match (Ireland-Wales, in case you are wondering), I took my computer (and the audience) into the session with the rugby streaming over the wifi. As soon as the game was over, it was time to present my hack for the weekend. The hack is a sunrise/sunset calculator that will be posted here tomorrow. As there were only three hacks presented, it stood some chance of claiming the prize. It didn’t win, but the voted result was closer than expected. Congratulations to Michael Dales for his winning hack.

Wherecamp was a great experience. Both days were memorable for the quality of the sessions and the generous spirit in which everyone shared their thoughts and ideas.The organisers stressed that anyone can organise a WhereCamp (or indeed any other camp) and encouraged us all to thing about doing so.

Ups and downs at WhereCamp

In meetings on March 13, 2010 at 10:54 am

The first day started slowly for me. By lunch time doubts had crept in about the event. But the post-lunch sessions were excellent, and more than made up for a slow start.

With six tracks it was hard to know where to go. So, I stayed put in the main room and had the sunrise/sunset SVG rendition working by lunchtime. Lunch itself was healthy – a pleasant change from the norm at geek events. The only ting I remember about teh morning session was Gary Gale’s “it is essential to be able to lie about your location” – which should ring true for all of us (clandestine activities or not).

Post lunch, in the main hall where there was a Q&A session on Open Street Map. It uses wiki technology with extensions – an approach which reinforces my feelings about wikis being a base infrastructure for data collection. The team showed some visualizations from the Open Street Map data collections and highlighted “shards of wrong” where errors are made glaringly obvious by presenting them visually. It was apparent that the value of visualizations may be in finding anomalies, rather than in confirming expectations.

Next up was a session of “info porn” – gorgeous visualizations of transport data. Hal Bertram of ITO showed a series of time-lapse animations of traffic data. At the kick-off we had been shown an animation demonstrating how collaborative mapping initiatives have grown exponentially. But this was more interesting, because of the deductions that could be made from watching the data move. While we were still salivating at the high definition animations, Hal finished by saying  “at its best visualization produces stuff that you want to look at, and learn from”.

Open Street Map 2008 Map Edits from Peter Dunn on Vimeo.

After that I found myself learning about lenticular printing . In the discussion Sarah Kate Norman suggested that it might be an idea to use lenticular printing for sign information in different symbols/languages when the Olympics come to London. The fine map print that was shown at the session was produced by a company called Riot Of Colour.

Then tried to get into the YQL session but the small room was heaving. There are many materials available online anyway – so that’s one for self-study.

The final session was a debate (not sure it was intended as such) about privacy. I stayed quiet but thought there was youthful optimism that the problem would fix itself after some high-profile incidents – it hasn’t worked for patents!

On the way home the train hit something – we were delayed by over two hours, but I used the time to hack. So it really was a day of highs and lows. Now to see what today has in store.

Looking forward to WhereCamp.eu

In meetings on March 12, 2010 at 8:21 am

En route to WhereCamp.eu (12-13 March 2010) ….

Having forgone the opportunity to be in the Czech Republic for XMLPrague, I decided to do some preparation for two days initiation into location-based computing at WhereCamp.eu.

So I started two projects before arriving: a sunrise/sunset calculator and a gps hardware hack. The calculator working and the £20 GPS USB dongle (from maplin) is emitting data – although it took a while to figure how to scan the com ports to detect which one was emitting the data. The plan before the event is to create graphs of annual sunrise/sunset data for given locations in SVG using the input from the GPS. But the point of these events is to be receptive to new deas – so who knows what will emerge.

So long as I can get to see the rugby tomorrow, follow xmlprague and sxsw, and find somewhere to crash tonight, there should be something interesting to demonstrate soon.