What's new

HTML & Javascript - Paano mapapa improve ang current location ng user

1nn0c3ntv5

Enthusiast
Joined
Feb 10, 2020
Posts
103
Reaction
81
Age
23
Yung web app na kailangan kong gawin ay kailangan makuha ng user location, may alam po ba kayo kung paano makukuha ang accurate o nearly accurate na coordinates na kinatatayuan ng user?

Ito yung mga solusyon na mga naisip ko:

1. GetCurrentPosition - Dito nirereturn niya yung position ng isang user na nasa iisang lugar

function getData() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(providePosition,showError);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
PROBLEM: Paano kung lumipat yung user sa iba pang lubar (example: Nasa Point A (Makati) si user tapos sumakay siya ng Jeep papuntang Point B (Manila) yung problema dito, most likely i rereturn na value ay Point A at hindi Point B, yung ginawa kong solusyon ay nasa #2)

2. WatchPosition - Dito parang minomonitor niya yung bawat paggalaw ng isang user mula sa isang lugar papunta sa iba pang lugar

function getData() {
if (navigator.geolocation) {
navigator.geolocation.watchPosition(providePosition,showError);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
PROBLEM: Hindi gaano kaaccurate ang data at minsan nag rereturn ng mga coordinates na hindi mo pa nadadaanan.

May alam pa ba kayong paraan kung paano makakakuha ng isang accurate o near accurate na coordinate gamit ang Javascript, C# o iba pang langgwahe?
 
parang may kulang yung gamit mo sa watchPosition


JavaScript:
      geolocation.watchPosition(handleSuccess, errorCallback, {
        enableHighAccuracy: true,
        maximumAge: 5000 // 5 sec.
      });
 

1nn0c3ntv5

Enthusiast
Do you have permission to track your users? Is this tracking for the benefit of the user or for the benefit of whom?
Yeah there's a permission with regards to the user being tracked. It was defined on the project scope and user agreement together with a personal validation.
 

graft

Honorary Poster
Parang spy app. hmm mahirap gumawa ng ganyan html/c# palang tinuro samen pero good luck sayo ts
 

Online statistics

Members online
1,704
Guests online
1,509
Total visitors
3,213

Forum statistics

Threads
1,234,659
Posts
21,663,232
Members
1,616,671
Attachments
1,739,624
Profile posts
100,329
Top