form.addEventListener('submit',(e)=>{
e.preventDefault();
db.collection('cafe').add({
city: form.city.value,
name: form.name.value,
latandlongofcafe: form.latitude.value, form.longitude.value //need help to advice on how to save lat and long
});
});--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7f1dfe24-d34f-48a2-af9a-242210bbb1bc%40googlegroups.com.
Hi Glenn,Firestore has a Geopoint data type. You can also use an array [<lat>, <long>] or an object {lat: <lat>, long: <long>}. See this video for an overview of data structures.☼, Kato
On Fri, May 29, 2020 at 8:31 AM Glenn Tan <rawis...@gmail.com> wrote:
Dear Sir/Madam--I am writing a web app using Javascript. I would like to seek advise on how to add/save a variable of type Geopoint to firestore? By default, variable could be add to firebase by add(var_A: value). However, a geopoint variable has two variable: latitude and longitude. So would like to enquire on how to write it. In my example below, I have a variable "latandlongofcafe" which is a geopoint.form.addEventListener('submit',(e)=>{
e.preventDefault();
db.collection('cafe').add({
city: form.city.value,
name: form.name.value,
latandlongofcafe: form.latitude.value, form.longitude.value //need help to advice on how to save lat and long
});
});
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7f1dfe24-d34f-48a2-af9a-242210bbb1bc%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/1d42f2a3-0702-4559-94a5-bc15489ce743%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CADypTEb93wJOYhqERGjP6i%3DFuqtWxjrqik4iY2VApFss7FN5xg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAKLuWM8cvAOi0mDaEANDkYVPu80vSbYCAHN7ZoQU5r7zGwt6MQ%40mail.gmail.com.
Thank you for advising. Sorry for the late reply, was busy with other works.
To update, as per your advice, i have understood how to use GeoPoint and implemented it successfully.For others in the community who may face similar issue in the future, this is what my code looks like:
coordinates: new firebase.firestore.GeoPoint(Number(form.lat.value), Number(form.long.value))
I would like to extend my thanks to Kato, greatly appreciate your help.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/1d42f2a3-0702-4559-94a5-bc15489ce743%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CADypTEb93wJOYhqERGjP6i%3DFuqtWxjrqik4iY2VApFss7FN5xg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAKLuWM8cvAOi0mDaEANDkYVPu80vSbYCAHN7ZoQU5r7zGwt6MQ%40mail.gmail.com.