Skip to content

Query not working if stored as GeoPoint #20

@michaeltheshah

Description

@michaeltheshah

I'm using GeoFirestore in both Android and iOS. With Android, to set a location the only option is to upload as a GeoPoint e.g. [0º N 0º E]. It looks like with iOS either a GeoPoint or an array of Double can be uploaded. This causes issues when querying since the iOS client is looking for an array of doubles.

internal func childAdded(_ snapshot: DocumentSnapshot?) {
        let lockQueue = DispatchQueue(label: "self")
        lockQueue.sync {
            
            let l = snapshot?.get("l") as? [Double?]
            if let lat = l?[0], let lon = l?[1], let key = snapshot?.documentID {
                let location = CLLocation(latitude: lat, longitude: lon)
                updateLocationInfo(location, forKey: key)
            }else{
                //TODO: error??
            }
            
        }
    }

This causes all queries to fail.

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