我正在探索Airbnb的东西如何工作,并对地理搜索感兴趣。我不知道Airbnb如何通过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请求中从客户端传递的“新西兰”字符串来检测此数据?
它们都有一台服务器,用于存储世界上每个城市(名称作为键)和位置。...(嗯...一个人可以从Wikipedia中获得所有这些信息)
或者他们一定使用过某些服务,例如Google Map地理编码服务:
https://developers.google.com/maps/documentation/javascript/geocoding
开放式街道地图也提供类似Google地理编码的解决方案API。