Postcode proximity search
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 somethi开发者_如何转开发ng 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
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.
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.
I wrote a site & free API that does this for you if it's any use - http://postcod.es
精彩评论