1

I have about 20 events (UK based if that makes a difference).

I will also have a form on a page where people can register their interest in attending one of these events. After they have submitted this form, they will be shown the location of the closest event to them.

Trouble is I have no idea how to do this. Is there anything linked to google maps that can achieve this or do I need to buy something that does this... or can it be fairly easily achieved server side based on the fact I only have a small number of events.

If it needs to be done server side I'm running asp.net (vb) or I'm fairly up to speed with javascript/jquery.

Thanks

Tom
  • 12,776
  • 48
  • 145
  • 240

3 Answers3

1

Most likely what you want is the harvesine-formule-math to calculate the distance from your client's location and your event. Like Luke worked it out a spatial index-query enabled database can help you greatly.

Micromega
  • 12,486
  • 7
  • 35
  • 72
  • I had to create an SQL database of all the lat/long in relation to databases (this is on the web) then write an SQL query using the haversine formula to work out the distance. – Tom Mar 22 '11 at 11:46
0

Take a look at this post by Howard van Rooijen:

http://howard.vanrooijen.co.uk/2010/05/05/ordnance-surveys-gb-postcode-to-longitude-latitude-dataset/

He has taken the Ordinance Survey postcode data and made it available in various usable forms (SQL Server 2005, 2008 and Mongo). You can then run a spatial query server-side against this data to find how many postcodes are within a given range of the event postcode.

Luke Bennett
  • 32,786
  • 3
  • 30
  • 57
  • FYI That link is now broken. – iamjonesy Jul 30 '13 at 11:35
  • Thanks for the heads up - I pinged Howard on this and seems he's got an issue at the moment. An alternative URL for the post in question is http://howardvanrooijen.wordpress.com/2010/05/05/ordnance-surveys-gb-postcode-to-longitude-latitude-dataset/ – Luke Bennett Aug 01 '13 at 20:13
0

I wrote a site & free API that does this for you if it's any use - http://postcod.es

Matt Roberts
  • 26,371
  • 31
  • 103
  • 180
  • Appears this site was replaced with random, irrelevant blog content. – Paul Apr 16 '13 at 14:41
  • Ahem, yeah, I didn't renew the domain :( I've not bothered to move it anywhere else 'cos I've not had the time, and frankly noone seemeed bothered about it :) – Matt Roberts Apr 17 '13 at 12:51
  • Darn squatters, no worries, just wanted to make sure others didn't follow this link for a solution. – Paul Apr 17 '13 at 13:43