Skip to content

How to fetch documents around a certain location #33

@Isuru-Nanayakkara

Description

@Isuru-Nanayakkara

Hello,

This might be a simple question but I'm having a hard time trying to figure out how to do this.

I'm developing an iOS app which transmits user's last known location periodically. My Firebase setup looks like this.

Screenshot 2020-05-18 at 18 12 28

It has a users collection. Each user has the aforementioned last location coordinate.

What I'm trying to do now is, given a location and a radius, fetch the set of users who fall within that radius.

I know I can initiate a query like this.

let circleQuery = geoFirestore.query(withCenter: center, radius: 10)

But not sure what to do after that. How do I get the results from this query?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions