簡體   English   中英

我如何 plot JavaScript 在同一條線上的兩個移動點

[英]How do I plot two moving points on the same line in JavaScript

我正在嘗試開發用於車輛的離線軌跡跟蹤 web 應用程序.... the position of the phone or system doing the tracking..... I've tried JavaScript libraries like chart.js, canvas.js and Mapael.js

我會喜歡關於我可以使用哪些庫的建議

Assuming that you have an Offline map API ( Leaflet is a good choice if you have not), you can use make a simple API that has the latest coordinates of the vehicle in the backend. 在前端,您幾乎沒有選擇。 您可以簡單地使用 setInterval 輪詢來獲取某個區間內的最新坐標,並更新在 map 上繪制的 object 的 lat 和 lon。 獲取數據的更好和更優化的方式可以是 Websockets 或 SSE(服務器發送事件)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM