本文介绍了谷歌地图路线和路线附近的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何用谷歌地图在图像中做这样的事情,有人知道怎么做吗.
How I can do something like here in image with google map, Is anybody know ho to do this.
这里是路线和路线附近的区域(绿色不透明区域)
So here is directions and area near route directions (green opacity area)
推荐答案
我会通过使用 Directions API 并获取每个 step
的纬度/经度.
I would approach this by using the Directions API and getting lat/lng of each step
.
然后我会使用 Polygons API 沿着 steps
沿着直线路径每 x 米绘制一个选定半径的圆.
I would then use the Polygons API to draw circles of a chosen radius, every x meters along a straight path following the steps
.
更好的解决方案是将 steps
与 Polyline
,并给它一个足够粗的strokeWidth
A better solution would be to use the steps
with a Polyline
, and give it a sufficiently thick strokeWidth
这篇关于谷歌地图路线和路线附近的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!