+ 18

How to display user position on a map?

I would display on a my project user position on a map, with API....I don't know how to do it with js? But I don't know how to make it... I search on Google, but I don't found good results... Can anyone please help me?

5th Nov 2020, 10:15 AM
Matthew
Matthew - avatar
5 Antworten
+ 6
Glira, see this code that uses the geolocation API: https://code.sololearn.com/WQ1CCC09Ehsl/?ref=app As an alternative, use the IP API(less accurate, but does not require user authentication) here: http://ip-api.com/json
5th Nov 2020, 9:13 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 7
⟭⟬ ᦋꪶỉꪹꪖ⁷ ⟭⟬ That is a problem. A map is supposed to be shown below. I can see a map. Try to scroll down and send me a screenshot
6th Nov 2020, 2:06 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 5
Use the search bar but in your code I see only the button 😰Is it a my problem?
6th Nov 2020, 7:22 AM
Matthew
Matthew - avatar
+ 5
https://drive.google.com/file/d/12byDAI8PJojY2HONgBkDNZVieEghBAht/view?usp=drivesdk Use the search bar i scroll down, But there was nothing 😰anyway thanks for the help 🙂
6th Nov 2020, 2:12 PM
Matthew
Matthew - avatar
+ 3
Location is all about longitude and latitude, and therefore if u have someone's latitude and longitude then you got a location of that some one. To get someone's location use the "navigator.geolocation" class. More info. https://www.dummies.com/web-design-development/javascript/how-to-use-geolocation-when-coding-with-javascript/ After obtaining the latitude and longitude, then use any online map like Google map, open street map and pass the latitude and longitude as parameters to see visual (GUI) map Let me know if it helped. thanx
5th Nov 2020, 11:38 AM
Kirabo Ibrahim
Kirabo Ibrahim - avatar