Airbnb在哪里储存它?

时间:2016-07-12 21:20:39

标签: google-maps geolocation google-places-api

我想知道Airbnb如何存储租赁房间的地理位置信息。

他们将其存储在Google服务或自己的服务器中?

1 个答案:

答案 0 :(得分:1)

您可以查看Google Cloud Platform。具体来说,您可以对Cloud Datastore感兴趣。

您可以向GeoPt添加Entity并执行地理空间查询。来自the documentation

  

要向实体添加GeoPt属性,请使用GeoPt类,指定纬度和经度:

Entity station = new Entity("GasStation");
station.setProperty("brand", "Ocean Ave Shell");
station.setProperty("location", new GeoPt(37.7913156f, -122.3926051f));
datastore.put(station);
     

使用数据存储区查询过滤器StContainsFilter来测试给定GeoPt中是否包含GeoRegion,例如:

// Testing for containment within a circle
GeoPt center = new GeoPt(latitude, longitude);
double radius = r; // Value is in meters.
Filter f1 = new StContainsFilter("location", new Circle(center, radius));
Query q1 = new Query("GasStation").setFilter(f1);

// Testing for containment within a rectangle
GeoPt southwest = new GeoPt(swLat, swLon);
GeoPt northeast = new GeoPt(neLat, neLon);
Filter f2 = new StContainsFilter("location", new Rectangle(southwest, northeast));
Query q2 = new Query("GasStation").setFilter(f2);