Skip to content Skip to sidebar Skip to footer

How To Add Or Save From Web Form (Javascript) Entry As GeoPoint Type In Firebase Firestore

Hi i have a web form which collect the following: -cafe name -latitude -longitude of its location. Currently, the lat and long is saved as map format instead of GeoPoint in Firesto

Solution 1:

If I'm right you need to send an array of coordinates to your firestore database so before the addition try this and then pass the array av value to your object's coordinates key.

let coords = []
coords.push(new firebase.firestore.GeoPoint(form.lat.value, form.long.value))

Solution 2:

you're missing correct referencing to your firebase app please see Vue.js Firestore save geopoint

the point you're missing is firebase import you have to import

import { firebase } from '@firebase/app';

the syntax you're using is correct

coordinates: new firebase.firestore.GeoPoint(form.lat.value, form.long.value)

Post a Comment for "How To Add Or Save From Web Form (Javascript) Entry As GeoPoint Type In Firebase Firestore"