我有大约 20 个活动(如果这有影响的话,以英国为基地)。
我还将在页面上提供一个表格,人们可以在其中登记参加其中一项活动的兴趣。提交此表格后,他们将看到距离他们最近的活动地点。
问题是我不知道该怎么做。是否有任何链接到谷歌地图的东西可以实现这一点,或者我是否需要购买可以实现这一点的东西......或者基于我只有少量事件的事实,它可以在服务器端相当容易地实现。
如果需要在服务器端完成,我正在运行 asp.net (vb) 或者我相当熟悉 javascript/jquery。
谢谢
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
发布评论
评论(3)
您最有可能需要的是哈维辛公式数学来计算距客户位置和活动的距离。就像卢克(Luke)发现的那样,支持空间索引查询的数据库可以为您提供很大帮助。
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.
看看 Howard van Rooijen 的这篇文章:
http://howard.vanrooijen.co.uk/2010/05/05/ordnance-surveys-gb-postcode-to-longitude-latitude-dataset/
他已接受该条例调查邮政编码数据并以各种可用形式提供(SQL Server 2005、2008 和 Mongo)。然后,您可以针对此数据在服务器端运行空间查询,以查找事件邮政编码的给定范围内有多少个邮政编码。
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.
我写了一个网站&免费的 API,可以为您执行此操作(如果有任何用途) - http://postcod.es
I wrote a site & free API that does this for you if it's any use - http://postcod.es