Mar
21
Everywhere you go, always take the weather with you
15 years ago, mid-March | Leave a Comment
Originally I wasn’t going to blog about this but I finally gave in so here it is. This is another one of those things that you really just can’t do with your iPhone unless you’ve jailbroken it.
Having the weather on your lock screen is nothing particularly new, there are enough Winterboard themes that allow you to do this. However, this is slightly different. I’ve never really understood why you’d only ever want to know what the weather was like in your home town. What does it matter? That is of course unless you never actually go anywhere. Why not have the weather for where you are? Yes I know you could just look out of the window or actually go outside but that’s beside the point. What I wanted was to have the weather for where I actually am right now. So, as part of my iPhone tracking system I added the ability for the weather to follow me too. The implementation is rather simple.
Since I’m already sending my location and retrieving the wallpaper image I’m also getting an override (overRide.js) for my weather configureMe.js. The overRide.js contains a single line, the location – as per the configureMe.js format:
var locale="Lelystad,NL" |
So each time the wallpaper is updated, so is this file. One of the key things you need to do to accomplish this for yourself is what is called reverse geocoding. That is, getting the name of your location from your GPS coordinates.
Now, the best way I’ve found of doing this so far is by using geonames this is a fantastic site that allows you to do the reverse geocoding without even blinking. For example, calling geonames using the url
http://ws.geonames.org/findNearbyPlaceName?lat=50.455&lng=-3 |
would result in the following xml being returned
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <geonames> <geoname> <name>Seaton</name> <lat>50.7049382166946</lat> <lng>-3.06999206542969</lng> <geonameId>2638278</geonameId> <countryCode>GB</countryCode> <countryName>United Kingdom</countryName> <fcl>P</fcl> <fcode>PPL</fcode> <distance>28.2265</distance> </geoname> </geonames> </xml> |
This gives you pretty much everything you could possibly want and for free too. Note the inclusion of your distance between your coordinates and the the coordinates returned (nearest named location).
Now I know what you’re thinking. Why would I retrieve a file with the data in it from my server, why not parse the xml in the javascript on the lock screen. You’re right, I could and you, possibly, should. I don’t because I keep all my GPS data in a database on that server so I update the database with the actual locations too. I don’t parse the xml on the iPhone because I don’t need to.
Of course I haven’t yet tested being in some obscure location that the weather provider doesn’t know about. Incidentally, geonames is so freaking good that, if you want to, you can download a daily dump of the database.
Tagged with: GPS • iphone • jailbreak • opensource • software • tracking
March 21, 2009 18:11
Aug
12
Winterboard Rick Roll
16 years ago, mid-August | Leave a Comment
Winterboard is a rather good application for a jailbroken iPhone that allows you to theme your iPhone’s appearance. It’s touted as a replacement for Summerboard, which I’ve never used. As with any theming you will want to download some, well, themes.
Read more…
Tagged with: iphone • jailbreak • software
August 12, 2008 10:26
Current Electricity Use (15min)
iPhone/Webkit RSS Reader
Links
- automated home
- Automated It Technology News
- awooga!!!
- LinITX
- My Acer page
- My Asterisk pages
- My Work in progress (old)
- Noble Race Car
- openmoko / neo 1973 wiki
- planet openmoko
- Spadgecock Cumpants