我在做一个小的手机app,用html5和google map api.主要功能是用户开始跑步,跑完了计算跑了多少公里,时速等。
我知道怎么测A点和B点的直线距离,有没有好点的方法测实际跑步距离而不是两个点直线距离?
PHP中文网2017-04-17 11:08:00
You can establish a mathematical model like this: For a path, set the collection coordinate point period t, and get a series of points P0(x,y), P1(x,y), ... , Pn(x,y) . Then fit it into a Bezier curve of degree 3 or higher (you may need to filter out some points with very small distances), and use Simpson's integral or other methods to find the path length between any points, plus your There is time information such as the collection cycle, The direct average speed of each point segment can also be calculated. The period can be provided to the user as a precision control interface.
PHPz2017-04-17 11:08:00
Use Baidu Maps. The positioning speed is very fast. It's easy to get the line. Calculate the length of the line directly.
天蓬老师2017-04-17 11:08:00
This can only be subdivided infinitely, for example, setInterval 0.1 seconds to calculate the current distance relative to the last time, and finally find sum