Please give a code for geolocation API | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Please give a code for geolocation API

I learnt geolocation API yesterday and I can't understand how to use it Please give a sample code that finds the location of user

7th Aug 2020, 1:46 AM
Raghu Rao
Raghu Rao - avatar
12 Answers
+ 1
That's the backend task that as programme you get data sent it to server (to you ). You can access it as For example Send this data That is position.coords.latitude To server.(to you ) And you will get the latitude of your user.similarily for longitude,altitude,speed ..... Sorry dude I don't know back end more.
7th Aug 2020, 6:39 AM
Divya Mohan
Divya Mohan - avatar
+ 4
I don't think this is html 5 geolocation api. This has been done using js library leaflet.js but very nice And geolocation api as much I have heard works only on secure origin i.e, https https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API I have tried it on sololearn but as it's playground is not https.... I got this error. https://code.sololearn.com/WeLcqUnkYx4R/?ref=app
7th Aug 2020, 3:12 AM
Divya Mohan
Divya Mohan - avatar
+ 3
Thanks Now it's more clear
7th Aug 2020, 3:15 AM
Raghu Rao
Raghu Rao - avatar
+ 3
I also wanted to ask that how will it return location
7th Aug 2020, 3:28 AM
Raghu Rao
Raghu Rao - avatar
+ 3
I mean if I send the link of my code to someone and he opens it,then how will I receive his location
7th Aug 2020, 3:29 AM
Raghu Rao
Raghu Rao - avatar
+ 3
How will that object reach me I mean how can I access it
7th Aug 2020, 3:34 AM
Raghu Rao
Raghu Rao - avatar
+ 3
I know this already Just I want you to tell me how I get to see that person's location by my eyes You just tell me how For e.g. via notification or message etc
7th Aug 2020, 6:25 AM
Raghu Rao
Raghu Rao - avatar
+ 2
If geolocation works succes fully position.coords give you an object having info like user latitude,longitude,speed,heading,altitude,accuracy.. Which can you easily extract from object.
7th Aug 2020, 3:33 AM
Divya Mohan
Divya Mohan - avatar
+ 2
Thanks
7th Aug 2020, 6:45 AM
Raghu Rao
Raghu Rao - avatar
+ 2
Complete python / php and enjoy backend.👍
7th Aug 2020, 6:45 AM
Divya Mohan
Divya Mohan - avatar
+ 2
Yeah Thanks for your assistance
7th Aug 2020, 6:47 AM
Raghu Rao
Raghu Rao - avatar
+ 2
Someone pls help me on html challenge 3 question
7th Aug 2020, 12:08 PM
Charis
Charis - avatar