0
我需要幫助做這個查詢與JDO:查詢半正矢與JDO
SELECT id, (3959 * acos(cos(radians(lat_t)) * cos(radians(lat)) * cos(radians(lng) - radians(lng_t))
+ sin(radians(lat_t)) * sin(radians(lat)))) AS distance
FROM Stores HAVING distance < 25
ORDER BY distance
我想諮詢與接近座標,和許多互聯網搜索,我發現這個算法半正弦波。 The source is Google。
這是你所需要的:
public static ArrayList<User> getUsers(double lat, double lng, double distance) {
PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(¿?¿?¿?);
...
return users;
}
謝謝!