Can you programatically draw pins (Markers) by dis

2019-07-29 04:26发布

问题:

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.”

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

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, 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.

Thanks.

回答1:

I have two Mile/Km Marker examples:

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

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

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

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