Geolocation



Geolocation

Gone are the days when we wander around a city with paper maps. Thanks to smartphones, we now know exactlywhere we are all the time, and we expect websites to use that information. I’m not interested in restaurants in Greater London—I want to know about restaurants within a 5-minute walk of my current location.

我们拿着纸质地图徘徊在街头的日子一去不复返了。感谢智能手机,任何时候,我们都精确定位自己的位置,我们期望网站使用这些信息。我对伦敦大街的饭馆不感兴趣---我想知道距我步行5分钟路程的饭馆。


But geolocation is only one part of the puzzle. The beauty of Elasticsearch is that it allows you to combine geolocation with full-text search, structured search, and analytics.

For instance: show me restaurants that mention vitello tonnato, are within a 5-minute walk, and are open at 11 p.m., and then rank them by a combination of user rating, distance, and price. Another example: show me a map of vacation rental properties available in August throughout the city, and calculate the average price per zone.

地理定位只是游戏的一部分。Elasticsearch的妙处是它可以让你把地理定位和全文搜索、结构化搜索、分析结合起来。例如:我想找提到vitello tonnato,步行五分钟,11点开门的饭馆,并给出结合用户打分,距离,价格的分级。另外一个例子:我想找整个城市8月假期出租信息地图,按照区域计算平均价格。

Elasticsearch offers two ways of representing geolocations: latitude-longitude points using thegeo_point field type, and complex shapes defined inGeoJSON, using the geo_shape field type.

Elasticsearch 提供两种途径定义地理位置:经纬度点使用geo_point, 复杂形状使用geo_shape, 在GeoJson中定义。

Geo-points allow you to find points within a certain distance of another point, to calculate distances between two points for sorting or relevance scoring, or to aggregate into a grid to display on a map.Geo-shapes, on the other hand, are used purely for filtering. They can be used to decide whether two shapes overlap, or whether one shape completely contains other shapes.

Geo-points可以找到据离某个点一定范围内的点,可以计算两点之间的距离用于排序,相关性打分,或者聚合成格子在地图上显示等。  另一方面,Geo-shapes用于过滤。可以用于确定两个形状是否重叠,或者一个形状包含其它形状等。




猜你喜欢

转载自blog.csdn.net/silent1/article/details/44775861