2016-07-12 6 views

答えて

1

Google Cloud Platformをご覧ください。具体的には、Cloud Datastoreに興味があります。

GeoPtEntityに追加して地理空間クエリを実行できます。

緯度と経度を指定し、GeoPtクラスを使用して、エンティティにGeoPtプロパティを追加する:the documentationから

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

GeoPtがに含まれているかどうかをテストするために、データストアクエリフィルタStContainsFilterを使用例えば、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); 
関連する問題