android - Search in Firebase based on distance -


i'm migrating application using mysql firebase, , managed migrate all, missing part of search, did not quite understand how works. i'm trying query below in firebase.

select *, (6371 * acos( cos(radians(?)) * cos(radians(latitude)) * cos(radians(?) - radians(longitude)) + sin(radians(?)) * sin(radians(latitude)) )) distance usuario order distance 

enter image description here

what i'm trying pass latitude , longitude of user firebase , returns me users ordering nearest farthest.

note: not same query use in application, find on google , not know if work, can idea of i'm trying do. note ²: english not native language :p

the example sql query provided uses capability of sql not exist in firebase: ability calculate expression using column values each row in table , use value of expression filter , sort query result.

i don't see way use firebase perform type of query want.

you might want take @ geofire library. have not used , capabilities seem related proximity filtering, not sort-by-distance feature need, maybe can adjust requirements make use of features.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -