【问题标题】:How does Airbnb implement geo searching?Airbnb如何实施地理搜索?
【发布时间】:2015-05-22 05:00:45
【问题描述】:

我正在探索 Airbnb 的东西是如何运作的,并且对地理搜索感兴趣。例如,我不明白 Air​​bnb 是如何通过New Zealand 找到他们的广告的?

如果要查看查询字符串参数:

page:1
location:New Zealand
ss_id:3sdsi3ff

只有位置字符串New Zealand 会发送到服务器,而不是像 lng、lat 这样的坐标。

但在响应中我们得到以下信息:

center_lat: -40.900557
center_lng: 174.885971,
geo: {accuracy: 1, district: null, city: null, state: null, country: "New Zealand", country_code: "NZ",…}
accuracy: 1
city: null
colloquial_area: null
country: "New Zealand"
country_code: "NZ"
district: null
market: "Other (International)"
natural_feature: null
result_type: "country"
state: null
state_short: null
success?: true

我们看到我们得到center_lat: -40.900557 center_lng: 174.885971 坐标,国家:"New Zealand",国家代码:"NZ"

那么 Airbnb 是如何根据 GET 请求中客户端传递的“新西兰”字符串来检测这些数据的呢?

【问题讨论】:

    标签: google-maps google-maps-api-3 geocoding geospatial geo


    【解决方案1】:

    他们要么有一个服务器,存储世界上每一个城市(名称作为密钥)和位置......(嗯......可以从维基百科获得所有这些信息)

    或者他们一定使用过一些服务,比如谷歌地图地理编码服务:

    https://developers.google.com/maps/documentation/javascript/geocoding

    开放街道地图也提供解决方案API,如谷歌地理编码。

    【讨论】:

    • 那么可以在服务器端使用地理编码吗?我正在使用 nodejs 服务器
    • 您是指 Google Maps API 吗?
    • 是的,谷歌地图 api
    • 感谢您的帮助。我真的对 Airbnb 如何解决这个问题很感兴趣 :)
    猜你喜欢
    • 2011-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-07
    • 2014-01-05
    • 1970-01-01
    • 2012-03-18
    相关资源
    最近更新 更多