如何"查找最近的地点和QUOT;工作?地点、最近、工作、QUOT

2023-09-11 03:02:33 作者:你好傻B

如今,大多数的餐馆和其他企业都有查找地点在其网站上的功能,其中列出最近的地点对于给定的地址/邮编。这是如何实现的?匹配对DB中的拉链code是一个简单的没有脑子的方法来做到,但可能不总是工作,例如可以有一个分支接近给定的位置,但可能是在一个不同的拉链。这使我想到的一个方法是把给定的zip- code /地址转换成地图坐标,并列出任何分支机构陷入pre定义半径。我欢迎你的想法如何做到这一点已经implemented.If可以提供像任何网络服务中使用等更详细的实施细则。

Nowadays most of the Restaurants and other businesses have a "Find Locations" functionality on their websites which lists nearest locations for a given address/Zip. How is this implemented? Matching the zipcode against the DB is a simple no-brainer way to do but may not always work, for example there may be a branch closer to the given location but could be in a different zip. One approach that comes to my mind is to convert the given zip-code/address into map co-ordinates and list any branches falling into a pre-defined radius. I welcome your thoughts on how this would've been implemented.If possible provide more detailed implementation details like any web-services used etc.,

推荐答案

很多地理空间框架会帮你出这一点。在地理空间的世界,一个zip code是只是一个多边形,它只是一个区域的定义明确的边界地图(不是在数学意义上的多边形)。在SQL Server 2008的空间,例如,你可以创建一个基于原始的多边形一个新的多边形。所以,你可以动态地创建一个多边形这是你的拉链code。通过一定的距离,在每一点上延伸。它采用的拉链code时髦的形状考虑。一个地址,这很容易,因为你只需创建一个多边形,它是围绕一个点一个圆圈。然后,你可以做查询,给你,你在这两种方法中创建新的多边形内的所有点。

A lot of geospatial frameworks will help you out with this. In the geospatial world, a zip code is just a "polygon", which is just an area on a map which defines clear boundaries (not a polygon in the math sense). In SQL 2008 spatial, for example, you can create a new polygon based on your original polygon. So you can dynamically create a polygon that is your zip code extended by a certain distance at every point. It takes the funky shape of the zip code into account. With an address, It’s easy, because you just create a polygon, which is a circle around the one point. You can then do queries give you all points within the new polygon that you created in either method.

很多这些网站基本上只是这样做。他们给你5英里扩展多边形内的所有点,然后也许10英里扩展多边形,等等等等。它们实际上不计算距离。在网络上的大多数马的东西是不是复杂的。

A lot of these sites are basically just doing this. They give you all points within a 5 mile extended polygon, and then maybe a 10 mile extended polygon, and so on and so forth. They are not actually calculating distance. Most ma stuff on the web is not sophisticated at all.

您可以看到一些基本的例子这里得到什么我说的是一般的想法。

You can see some basic examples here to get the general idea of what I'm talking about.

 
精彩推荐
图片推荐