让用户在谷歌地图上绘制曲线?
有没有人有任何例子或来源让用户绘制从a点到b点的曲线图?
谢谢, 亚历克斯
Does anyone have any examples or source for letting users draw curved maps from point a to point b?
Thanks,
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以这样绘制贝塞尔曲线:
您可以修改代码,提供不同的绘制线条的策略。实施的那个是用“阴影”指出的。
使用方法非常简单:
You can draw Bezier curves this way:
You can modify the code, to provide differents strategies to draw the lines. The one implemented is pointed with "shadow".
The usage is pretty easy:
您可能需要在谷歌地图上使用某种图层。我知道有一个云应用程序可以让你在谷歌地图上拼字,但它使用闪存来嵌入谷歌地图 scribblemaps.com/… 我不认为可以使用两个点来创建一条曲线,也许超过两个点。
如果我对你的应用理解正确的话,根据你的网站,你希望达到的目标是让用户“开辟道路”?如果是这种情况,也许您可以创建一个表单,用户可以在其中提交他们“闪耀”的“试验”的 Lat Lng 坐标,然后使用 Polyline 绘制类似于此的曲线 谷歌地图绘制曲线。
但是,如果用户只是想知道如何从 a 点徒步到 b 点等,那么您可以使用 DirectionService 和 DirectionRenderer,并将 DirectionsTravelMode 设置为
google.maps.DirectionsTravelMode.WALKING
并以这种方式在地图上呈现方向,以便用户知道如何使用地图上绘制的方向 + 实际方向说明来徒步旅行。you might have to use some sort of layer on top of google map. I know there's a cloud app that allows you to scrabble on a google map, but it uses flash to embed the google map scribblemaps.com/… i don't think it's possible to use two points to create a curve perhaps more than two points.
If i understand your application correctly, based on your website, the goal that you wish to achieve is to let users to "blaze a trail"? If that is the case maybe you can create a form where the users can submit Lat Lng coordinates of the "trials" that they've "blazed," and then use Polyline to draw the curve line similar to this google map draw curved line.
However, if users just want to know how to hike from point a to point b and etc, then you can use DirectionService and DirectionRenderer, and set the DirectionsTravelMode to
google.maps.DirectionsTravelMode.WALKING
and render the direction on the map that way so the user would know how to hike a route with directions drawn on the map + actual direction instructions.