您可以通过编程在自定义Google地图路线上按距离绘制图钉(标记)吗? [英] Can you programatically draw pins (Markers) by distance on a Custom Google Map route

查看:130
本文介绍了您可以通过编程在自定义Google地图路线上按距离绘制图钉(标记)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

访问Google网站并登录后,您可以单击页面顶部工具栏菜单中的地图选项。单击我的位置按钮,然后选择创建地图。

When going to the Google website and signin in you can click on the "Maps" option from the toolbar menu at the top of the page. Click on the "My Places" button and choose "Create Map."

您可以选择跟踪路线,例如,该地图: https://maps.google .com / maps / ms?msid = 2048989444452626756756004004d03638beb43c93029& msa = 0& ll = 6.235122,-75.536343& spn = 0.003088,0.004823

There you can select to trace a route, for example, this map: https://maps.google.com/maps/ms?msid=204898944445262337567.0004d03638beb43c93029&msa=0&ll=6.235122,-75.536343&spn=0.003088,0.004823

有一些知道通过JS(也欢迎使用其他语言)的方式,我可以说一个Pin(标记),距我追踪的路线起点50 mts? google内有一些路线的距离数据,但是我还没有找到一个好的教程,也没有找到有关如何使用这些地图的答案。

There's some know way that via JS (other languages are also welcome) , i could put a Pin (Marker) let say, 50 mts from the start of the route i traced? There are some distance data of the route within google, but i haven't found a good tutorial, or any answer on how doing this with these maps.

BTW,我可以以编程方式绘制一条路线并通过代码通过这种方式抛出标记来计算地球的距离,但事实是,我要开始使用的地图就像我之前写的链接中的地图一样,因此路线是

BTW, I can programatically draw a route and throw the Markers via code this way calculating the distance of the earth, but the thing is that the maps that i'm getting to start with are like the one in the link i wrote before, so the route is actually made by anyone.

谢谢。

推荐答案

我有两个英里/公里标记示例:

I have two Mile/Km Marker examples:

  • Km Markers every 2 km
  • Marker at 9.5km and 64.8km

他们使用Mike Williams的 epoly 实用程序,为v2 API编写的代码,我移植到v3

They use a method, GetPointAtDistance, from Mike Williams' epoly utility, which he wrote for the v2 API and I ported to v3

可以使用v3几何库在本地进行相同的操作,但是当我移植epoly时并不存在。

It is possible the same can be done more natively with the v3 geometry library, but that didn't exist when I ported epoly.

您可以如果您使用第三方库(例如 geoxml3

You can do the same with a polyline from KML if you render it on the map as a native Google Maps API v3 Polyline using a third party library like geoxml3

这篇关于您可以通过编程在自定义Google地图路线上按距离绘制图钉(标记)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆