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用於過濾。可以用於確定兩個形狀是否重疊,或者一個形狀包含其它形狀等。




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章