Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

javascript - Google Maps API-如何删除位置峰值(Google Maps API - How to remove location spikes)

I am trying to create a location tracking app, in which mobile application sends current lat-long and timestamp in every 10 seconds.(我正在尝试创建一个位置跟踪应用,其中移动应用每10秒发送一次当前经纬度和时间戳。)

it works fine when the mobile device is moving.(移动设备移动时,它工作正常。) but when the mobile device is still for sometime ~ 1-min, it starts sending location of different places which results in location spikes and decreases the location accuracy and other factors depending on it, is there any way i can minimise or nullify those fake locations, i didn't find any solution for mobile end as well.(但是当移动设备在大约1分钟内仍处于静止状态时,它开始发送不同位置的位置,这会导致位置峰值,并降低位置精度和其他取决于它的因素,有什么方法可以使这些假位置最小化或无效? ,我也没有找到用于移动端的任何解决方案。) PS i, am using android app to send information to firebase and then retrieving it from there on browser(PS i,正在使用android应用将信息发送到firebase,然后从浏览器中检索信息) Here is the sample code to draw path(这是绘制路径的示例代码) /* history contains all the location traces in lat-long */ var linePath = []; for (var i = 0; i < history.length; i++) { var tempLatLng = new google.maps.LatLng(history[i]['lat'], history[i]['long']); linePath.push(tempLatLng); } var line = new google.maps.Polyline({ path: linePath, geodesic: true, strokeColor: '#669DF6', strokeOpacity: 1.0, strokeWeight: 6 }); line.setMap(map) spikes when device is still(设备静止时达到峰值) correct location when device is moving(设备移动时的正确位置)   ask by anuj jain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The effect you're seeing is almost certainly just the device GPS and location services being inaccurate.(您看到的效果几乎肯定是设备GPS和定位服务不准确。)

It's very common, especially indoors.(这很常见,尤其是在室内。) If you don't want to record these inaccurate readings, you will have to detect them on your own, or find a library that can smooth out the series of readings.(如果您不想记录这些不准确的读数,则必须自己检测它们,或者找到一个可以使一系列读数平滑的库。) As far as I know, there is no API provided by Google Maps that will do this for you.(据我所知,Google Maps没有提供任何API可以帮您做到这一点。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...