Angular不会将Firestore GeoPoint存储为GeoPoint

时间:2020-09-19 16:49:20

标签: angular firebase dart google-cloud-firestore

从Angular应用程序中保存GeoPoint时,请在我的代码下面。

var locationData = new firebase.firestore.GeoPoint(-26.20227, 28.04363);

var data = {
        Name: this.addFoodOutletForm.value.Name,
        //Description: this.addFoodOutletForm.value.Description,
        Address: this.formattedAddress,
        Enabled: false,
        Average_Prep_Time: parseInt(this.addFoodOutletForm.value.AvgPrepTime),
        Offering: this.addFoodOutletForm.value.Offering,
        Cover_Image_Url: 'https://firebasestorage.googleapis.com/v0/b/steera-app-qa.appspot.com/o/no-image-1.jpg?alt=media',
        Online: false,
        Rating: 0,
        Phone: this.addFoodOutletForm.value.Phone,
        Email: this.addFoodOutletForm.value.Email,
        Store_Coordinates: this.locationData,
        Location: this.location,
        Trading_Hours: {
          opening: opening,
          closing: closing
        }
      };

this.api.addDocument(data, 'FoodOutlets')
        .then((result) => {
          this.spinner.hide();
          this.router.navigate(['./food-outlets/steera-outlets']);
        })
        .catch((error) => {
          this.spinner.hide();
        });

我的flutter应用程序按如下方式保存GeoPoint:

Position location = await _initCurrentLocation();
      steeraDriverProvider.driver.currentLocation =
          GeoPoint(location.latitude, location.longitude);
      steeraDriverProvider.add(steeraDriverProvider.driver);

*上面的添加与Angular中使用的addDocument相同

现在的问题是,从flutter(dart)保存Firestore GeoPoint和从Angular保存Firestore GeoPoint时,我得到的结果不同。

查看随附的飞镖和角度图像,以了解如何存储数据。

flutter correct image angular incorrect image

请帮助。

0 个答案:

没有答案