1
您好我一直在關注這個教程http://googledevelopers.blogspot.com/2014/12/building-scalable-geofencing-api-on.html,這裏是我的問題,搜索JTS STR樹
我有經度和緯度座標的列表,我已經加入到一個JTS(Java的拓撲套件)STR樹作爲點。
現在我想發送一個形狀爲圓形的區域到STR樹來查找所有落在圓圈中的點。
Coordinate center = new Coordinate(entity.getLongitude(), entity.getLatitude());
GeometricShapeFactory gsf = new GeometricShapeFactory();
gsf.setCentre(center);
gsf.setNumPoints(20);
**gsf.setSize(320.0);**
Polygon poly = gsf.createCircle();
Coordinate[] coordinates = poly.getCoordinates();
//Create polygon from the coordinates.
GeometryFactory fact = new GeometryFactory();
LinearRing linear_ring = new GeometryFactory().createLinearRing(coordinates);
Polygon polygon = new Polygon(linear_ring, null, fact);
List<STRLeaf> items = strTree.query(polygon.getEnvelopeInternal());
然而搜索的結果發回數據的所有中的經度和緯度點的樹。當我將圈的大小降低到320以下時,我沒有收到搜索STR樹的結果。有沒有人有這個理想的經驗,我想創建一個圈,找到~7miles圈內的所有點。
感謝您的時間