Caching Google Maps Geocoder Results

After my post Geocoding UK Postcodes with Google Maps API I’ve had a few people contact me about caching geocoding results back to a server, for subsequent pages.

It’s a good question – Google’s geocoder permits you to make 50,000 queries a day, which sounds like a lot. However, that is only 35 a minute, which if you sustain for more than a few minutes, kicks in the limit (apparently…). So you might be interested in caching your results.

If you aren’t fussed about UK geocoding, you can access the regular Google geocoder using HTTP, as documented in the Google Maps Documentation.

However, if you want to temporarily cache results collected by the client (as per my UK geocoding example linked to above), you need to send them back over an AJAX connection, and that is what this article discusses. Although aimed at using the UK geocoding technique, a lot of this tutorial will be applicable to results via the normal Google Javascript geocoder.

So what this short tutorial is going to do is show you how once a postcode has been translated into longitude and latitude, the result can be sent back to your server to be temporarily stored in a database. Then we are going to look at how we can query our own database before we query Google’s, for each result.

Note: I’m told it used to be in Google’s Terms that you couldn’t store geocoding results, but it doesn’t appear to be that way now. However, we are only going to store them temporarily, so we don’t have to hit Google’s server repeatedly for the same query.

If you are eager just to see how this all will work, you can go straight to the demo page.

So, lets get going…

Continue reading

Geocoding UK Postcodes with Google Map API

Notice: As a few people have pointed out, this announcement from Google means Geocoding is now built in. Yet as more people have pointed out – it kinda sucks accuracy wise (think over a mile off on some postcodes!), whereas my method continues to be accurate.

Google Maps API provides a geocoding feature, for finding the latitude and longitude of places or addresses; but it does not work for UK postcodes. This is thanks to Royal Mail who have a copyright on the data, and are very restrictive with their (expensive) licenses for it.

There are various solutions out there for using 3rd party services and importing the data to be used with Google Maps, or for using community built databases for the info. However, I’ve had a few people ask me about doing it just though Google.

It is possible — Google AJAX Search API does provide geocoding for UK postcodes. We need to use the two APIs in harmony to achieve our result.

So here it is.

Continue reading

Grow up, Mashup!

Is 2006 the Year of the Mashup? I think not. Mashups are at the stage that DHTML was at before it matured into Web 2.0 – lots of bells and whistles, but little real meat. 2006 will see people acclimatise themselves to the principles and technology, and maybe the best thought out mashups will become established. But it will be 2007 that will truly be the Year of the Mashup.

Programmableweb.com currently tracks 979 mashups, and 269 APIs, and shows a rate of 2.7 new mashups per day, so mashups are obviously very popular, so what’s the problem?

Continue reading

All d.Constructed out.

d.Construct 2006 is over and it seems a great deal of fun was had by all.

Lots of people have commented on the day as a whole, so I’ll save repeating what they have said. To read them check out Technorati or Aral Balkan has made a list.

Overall, I had an fantastic time down in Brighton, the presentations were both fun and informative and I had a great time at the after party, meeting some awesome people who I really hope to meet again.

An extra bonus of the day was I won a prize for the Morse Code message I left for the podcast. I won several books, provided by Apress, all of which will be very useful.

On a side note: The Mac to PC ratio was about 9:1, which was much higher than expected. I’ve always been an Apple fan, and worked for Ambrosia Software for a number of years before moving to the web industry, so it was great to see the glowing Apples everywhere I looked. 🙂

[tags]dconstruct06[/tags]

d.Construct – A geek golf tournament!

So, the 2006 d.Construct conference is very almost here.

I’ve seen various other posts about the conference. But they seem to be missing the most important aspect of the conference…

The geek golf tournament!

Yes, this is incredibly exciting – there is a geek golf tournament at the conference after party (sponsored by Snipperoo).

My schedule for tomorrow actually looks like this:

9am: Practice Mini Golf.
4pm: Drive to Brighton.

To prove I’m not kidding, tomorrow I’ll be uploading some photos of my practice.

Update: Here are a couple of photos of my golf practice!

Tom lines up the all important putt.

Tom just looking 'cool'

[tags]dconstruct06, dconstruct[/tags]