Geocoding UK data (latitude & longitude) using Google maps API with PHP

Quick post if anyone is interested.

I currently have an out of date script running on my golf website golfshake.com which allows people to search for golf courses within a particular distance of a postal code in the UK. This is done by taking the latitude and longitude of a postal code and running a spatial query to find the golf courses within my database. This worked great until the free web services I was using for lat and lon postal code lookups was turned off :( unfortunately in the UK the postal data, including latitude and longitude values, is held by the Royal Mail and only available for some riduculous charge.

I’ve been meaning to fix this for some time and had bookmarked this site which had a neat script for extracting the longitude and latitude from postal codes in the UK using the Google maps API. This is great but it’s a UK only solution and works only on postal codes.

Well I’m glad to say that Google annouced at the beginning of July that UK geocoding is now available which extends to postal codes, addresses and locations.

Great I can now use the google API via a HTTP call to retrieve XML data for any location in the world but how can I use it in a PHP script ?

http://maps.google.com/maps/geo?q=90210&output=xml&key=ENTER_YOUR_API_KEY

This will return an KML file containing; search term, full address, country, area, locality, longitude and latitude etc

Obviously I could use XML functions in PHP to browse the XML DOM, great article on this exact topic, but unfortunately PHP is limited in XML functionality in versions below PHP 5. You can even use CURL if it’s installed.

Thankfully the Google maps API is quite extensive and does not just provide XML output. One simple change of the output method to csv, will output simple data in CSV comma delimited format like :

200,5,34.099558,-118.411512

Therefore for simple latitude and longitude data retriveal the PHP code is very simple indeed and is just a case of retrieving the URL and exploding the data into an array for use within your PHP code.

$address = urlencode($postal);
$url = “http://maps.google.com/maps/geo?q=$address&output=csv&key=YOUR_API_KEY”;
$content = file_get_contents($url);
$data = explode(”,”,$content );

Then you can use array calls to retrieve the data ie $data[2] will get the lat and $data[3] the lon.

Build or buy

Hmmmmmmmmmm. Tough question really, I’m just at stage to work on a few new developements for golfshake.com the online golf community I run and do I write the software myself or use free/paid for off the shelf applications ?

Now I could quite easily write everything myself but should I not just concentrate on my niche areas which is the golf handicap and golf score tracking elements of the site. If I wrote everything then some parts of the site might not see updates for many months, not be as good as similar dedicated applications and not really work.

On the other hand if I purchase off the shelf applications I will get supported and maintained applications that should see regular releases but they will not quite function like I would hope and I would still need to spend time integrating.

I suppose this all comes down to time, money, resource (skills, ability, techs etc) and long term strategy. If I’m talking about a simple online photo gallery for the golfers, golf groups and golf events then it might be worth spending the time developing, as long as I’m not setting out to develop a full blown flickr application.

Follow up articles :

http://web.mit.edu/wwwdev/cgiemail/buybuild.html
http://www.awprofessional.com/articles/article.asp?p=21775&rl=1
http://www.learningcircuits.org/2002/jan2002/elearn.html

Cheerio :)

Was that the world of the internet ?

Well today I attened the Internet World show at Earl’s court in London, UK. Was it really the world of the Internet ?

For me it was good and I did get a lot out of it in terms of contacts, ideas and software but I felt like there should have been more. Before the event there was a lot of talk about web2.0 and this being one of the big features of the show. In all honesty, other than a lot of presentations taking about stuff many bloggers and online sites have for the last 12 months, there wasn’t much there to do with web2.0. I was expecting to see more technologies, bespoke software, software development and something cutting edge.

Other than linkedin.com and huddle, who also had a great presentation from the CEO Alastair Mitchell, there was nothing to do with web2.0. I was even asked to complete a survey and asked something along the lines of ‘Do you think web2.0 ….’ 1, is all hype 2, is about new technologies 3, Don’t know . :) For me I think it’s 1 and 2 but despite a 5 minute conversation and had to settle for no answer.

I suppose the question above is really were it all went wrong for me, I should have read the strapline on the website, ‘Business for the digital age’. This event was more about big corporations finding out about emerging software and selling new software, not a cutting edge internet event with product demos and software launches. I sat down to watch a presentation from channel4 about vodcasting/video streaming online, after 5 mintues I walked out after watching a marketing/selling pitch from channel4.

If you are looking for a CMS application, think you should be advertising online, need to understand SEO, work for a large organisation then this is the place to visit.

If you think you understand what is going off, see your self as an innovator, developer and someone who keeps up with the latest news and technologies then this isn’t the place to visit.

:)

GOLFSHAKE.COM LAUNCHES AT THE LONDON GOLF SHOW!

GOLFSHAKE.COM LAUNCHES AT THE LONDON GOLF SHOW!

golfshake.com the new home for golfscoretracker.co.uk – everything golf, with a twist!

golfshake.com

golfshake.com is an active online community of regular golfers and group organisers that features a free golf handicap and score tracking service as well as a comprehensive golf society and event management facility. In addition, it provides a wealth of knowledge and advice on everything golf including reviews and tips on courses, travel destinations, technique and equipment.

“golfshake.com is very exciting, it successfully takes golf from online to on-course and back again by enabling golfers to meet, manage their golf groups, organise events and play,” explains Darren Ramowski, Director of golfshake.com. “It is a place where golfers can get together online, discuss the latest hot golfing topics, ask for advice and post their views.”

golfshake.com is offering all golfers who sign up to the premium service before 15th May 2007 fourteen months for the price of twelve.

Promote your site - the new online directory listing services

Strange how things move on and times change, technology advances and we adapt.

Originally to promote and list your website or business you would use online directory services such as DMOZ or sites like Yell. There are also a whole host of niche industry specific sites where you can list your site, hey I even wrote my own free php script which others could use for this purpose and I ran on my golf resource site. Some are free and some paid for.

Well now there seems to be a new push, promoting your site in a more visually appealing way. Categoristation is still needed but these sites seem to work and it’s something different.

First there was the million dollar home page, albeit it wasn’t free, we now have the Milliondollaravatar and there a now loads of new sites cropping up offering the same kind of service.

There are even some good sites targetted towards the wave of new web2.0 sites and applications, check out bla.st and the cool Go2Web20.net listing the the company logos, again a form of promotion and linking.

So to list and promote your site there is now even more choice and opporunity in promoting your business, virally spreading thw word and helping with your SEO.


Great web2.0 youtube video

Too good to write about, just watch and enjoy.

Building Social websites - target, drive, grow, earn

Found a great article detailing some of the larger well known web2.0 social websites and how they started which was initially towards niche markets.

http://bokardo.com/archives/starting-a-social-app-find-a-niche-and-work-outward/

I did post a comment on the site but thought it was worth discussing further

Target
From the outset if you target a particular market or niche it should help to define your scope and keep you in reality. Rather than trying to target everyone and never being able to actually develop and deliver anything. Aim to provide for your niche and not everyone. This should also allow you to focus on potential revenue streams aimed at your niche market instead of just trying to build something big and hoping the revenue follows.

Drive
Next get out there and get involved and interact with the user base. If your passionate and driven about what your are doing your user base will see and feel part of something. This should add loyalty and help build a community.

Grow
From here you should hopefully start to see a community build and grow organically, hopefully if you are doing things right from word of mouth and other websites talking about it.

Earn
Hopefully if you are doing things right and planned from the beginning you should now be able to start hooking into potentially revenue streams.

You should hopefully have a growing community and a website with a sense of purpose providing a valued worthwhile service to loyal users (don’t think I’m ready for Corporate life and big profits :) lol)
There is also some similar information over at 37signals in the ‘Getting Real‘ publication.

Are golfers ready for web2.0 ?

In a past post I have written about an online social website aimed at golfers which fits well with all the talk around social sites for a niche audience and offering more than just creating a public profile. Well now I’ve gone a step further and introduced a load more features inline with web2.0 social sites. Are golfers ready ? who knows really.

In brief the site provides a place for golfer to record, track and analyse their golf score online and also tracks their golf handicap inline with the relevant county golf handicapping system. Users can also analyse and compare scores with their golf buddies, access a golf forum, reiew golf courses and access golf group and golf event management systems.

To move it towards web2.0 I’ve introduced public golf space, public golf groups, tag clouds, user images, RSS feeds, UGC in terms of forums, reviews and blogs and a lot more I can’t even remember. So what have I done,

Golfer profile and ‘my golf space:)

I’ve basically pulled together loads of information already held in the site and updated the existing user profile page. Profiles can now be public so none golfscoretracker users can view the profile, introduced a photo list of golf buddies, listed users golf groups, introduced tag clouds for users favourite golf courses as well as proving quick links to golf stats and user golf information. The page also provides a link to the users golf handicap.

Golf groups and golf societies

I’ve also updated and tweaked the existing golf society system so that it is much easier for users to create their own golf groups which others can join. The golf groups allow users to run and organise golf events as well as providing a golf group message board and group golf blog.

The golf groups can now be set to public so that again non golfscoretracker users can viewthe golf group, golf events and leaderboard for the golf group.

Golf event and golf competitions

The golf event system has been updated to make it easier to use, allow public golf events which members can join and provided RSS feeds.

A full overview of the golf group and golf events being used live can be seen on the golf group pages for the golfscoretracker golf society pages.

Any golfers interested in finding out more, then visit www.golfscoretracker.co.uk to register and sign up for free and starting tracking your golf scores and golf handicap online as well as becoming part of an online golf community.

Moderating UGC (User Generated Content)

I suppose really this poses a question,can you and should you ?

To some degree you have to and site owners should comply with any T&C’s they have in place but it’s a very fine line with censorship and ensuring user loyalty.

I guess this is a lot easier with sites that require registration and users are actually members of a site.  The problems start when you allow free open access.  A great site I found before Christmas and we had fun pimping our IM avatars at the office [PikiPimp.com] seems to be coming under abuse over the last few weeks with images some would find offensive.

It’s the minority and allowing the user base to moderate can only increase loyalty and security in the site, similar to how youtube.com works.

Techcrunch sold out ? Sam Sethi fired.

Update : Looks like Mike is on the case now

Whilst I appreciate TechCrunch is a commercial entity, I’ve never really given this much thought. For me I just saw it as another blog charting the real world, online relevant to an industry I work in and am interested in. I must also say what Michael Arrington has done is fantastic and I always thoroughly enjoy reading both the TechCrunch.com site and the UK version uk.techcrunch.com.

But are we all just fooled ?

Is this a personal blog ? review site of internet companies ? web2.0 review site ? or are we reading a commercial blog with the main focus of generating revenue ?

I’m not sure and does it matter ?

Today it looks like Sam Sethi at the UK site has been fired over posts he made about Le Web3 and comments from the organiser which seemed to get personal. In a true censorship style, comments and posts are no longer available. Sam’s final post over at uk.techcrunch.com was

Following yesterday’s post about Le Web and Loic’s retort. It seems Mike Arrington has disagreed with my post and opinion believing my actions to be vindictive towards Loic. What was said between Mike and I will remain confidential but suffice to say I can no longer remain with TechCrunch UK & Ireland. It is a very sad after all the work that has gone into TechCrunch UK and Ireland. I wish all of the UK and Irish entrepreneurs well. I will be personally blogging back at www.vecosys.com and looking for something new to keep me busy. Bye

But just like Michael posted about late last month, with a few simple searches the articles can be retrieved. Sam did a fantastic post about all the good stuff for next year but this is missing as well.

Now should we just accept this ?

If I had a public exchange of words with my employee then would it be unreasonable for them to discipline or fire me.

Personal blogs are just that, personal and can reflect an individuals true feelings and opinions.

Commercial blogs are there for a reason so should we expect any different and accept a level of editorial censorship and targeted advertising ? If we do then what do we get ? just another newspaper but online with their own agends, commercial gains and long term goals ?
I for one thought I was getting something else, a true insight into something that interested me but now I’m not so sure.

As at writing this, neither Techcrunch.com or uk.techcrunch.com have made any comments on this, so I await the response.

WordPress Themes