codediodeio / geofirex

:globe_with_meridians: :round_pushpin: Geolocation Queries with Firestore & RxJS
https://geo-test-c92e4.firebaseapp.com/
477 stars 106 forks source link

Unable to query database from Angular application. #108

Open JoshWilliams92 opened 4 years ago

JoshWilliams92 commented 4 years ago

Hello, I was following the tutorial but cannot seem to query the dataset./ It must also be noted that you cannot save the data as an object type anymore in firestore so I saved the data as a geo-point.

I am using the following two options: Option 1)

I declare the following in the ngOnInit lifecycle hook:

"const center = this.geo.point(51.5249949, -0.7466908); this.points = this.radius.pipe( switchMap(r => { return this.geo.query('positions').within(center, r, field) }))"

The following error appears in the chrome console log

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'GeoPoint' of undefined TypeError: Cannot read property 'GeoPoint' of undefined

Option 2)

I found the following github repo which referenced the error message above: https://github.com/angular/angularfire/issues/1604

I declare the following in the ngOnInit lifecycle hook:

"const center = new firestore.GeoPoint(51.5249949, -0.7466908) this.points = this.radius.pipe( switchMap(r => { return this.geo.query('positions').within(center, r, field) }))"

The following error message appears under the center parameter in the within():

"Argument of type 'GeoPoint' is not assignable to parameter of type 'FirePoint' Type 'GeoPoint' is missing the following properties from type 'FirePoint': geopoint, geohash"

jasonc624 commented 4 years ago

Yes im having this same issue since upgrading angular/fire i think they no longer export it in the new version and geofirex needs to account for this.