如何在谷歌地图中添加文本上述折线?折线、图中、文本、上述

2023-09-05 07:52:11 作者:○o笨尐猪〞

我有2个指标,我想提请它们之间的线,并有显示线之上的距离的文本,就像在谷歌地图网页版。

I have 2 markers, I would like to draw a line between them, and have a text showing the distance above the line, just like in the web version of google maps.

我已经找到这一下拉2个标记之间的线,但我怎么添加上面的一行文字?样品

推荐答案

一个想法是利用自己的经纬度和坐标长来计算两个标记之间的中点,然后把与任何信息,你要显示的信息窗口。或者像下面这样可以帮助:的 链接

One idea would be to calculate the midpoint between the two markers using their lat and long coordinates and then put an infowindow with whatever information you want to show. Or something like the following could help: Link