Request nearby places

I use Firebase to store Users with their latest expanded latitude and longitude.

The entry is as follows:

"Bdhwu37Jdmd28DmenHahd221" : {
  "country_code" : "at",
  "firstname" : "John",
  "gender" : "m",
  "lat" : 11.2549387,
  "lon" : 17.3419559
}

Whenever a user clicks on a specific Search button, I want my Firebase feature to pull people closest to the person who sent the request.

Since Firebase only allows one field to be requested, I decided to add country_code to have some range limitations and a request for this field. But it is still very slow when I load each user in a specific country, and then check the minimum distance between this user and all other users in the same country.

Already with 5 users, the function takes about 40 seconds to achieve results.

, - .

- , , country_code, ), ?

+6
1

Firebase . , . , , , .

, Geohash. :

  • ,

: Geohash , .

  1. Geohash , , ( ).

, ,

  1. , ( ) . , .

, , .

, , Geohash Firebase: , , , , . !

Firebase Geofire, Geohash Geolocation Realtime. JavaScript, Java Objective-C/Swift.

Geofire, :

+12

Source: https://habr.com/ru/post/1016484/


All Articles