开发者

Google Maps API Send Email With Directions

I used the Google Maps API to create a map with a custom input field tha开发者_Python百科t displays directions to a fixed address after the user submits the starting point in the form. Now I would like the user to be able to email herself or another person a link to google maps with the directions already plugged in. This functionality already exists on regular google maps but I don't believe there's anything built into the API for reproducing this. Does anyone have any ideas or thoughts?

PS, sorry I can't include a link to the site because it has not launched yet and I don't think my client would want everyone looking at their new site before it's finished :). However, I'll try to clarify as much as needed if anyone is confused. Thanks.


Seth is right, you can generate the right url to Google Map service knowing the correct parameters. This ressource lists several url formats.

My personal favorite is :

https://www.google.com/maps/dir/<start-location>/<other-location>

You can use it with an address or latitude/longitude, like :

 https://www.google.com/maps/dir/48.856614,2.352222/52.520007,13.404954


You could just create a link that is populated by your code.

http://maps.google.com/maps?&q=1000+Some+Street,+City,+NC+to+1000+Some+Other+Street,+City,+CA

That will open to Google maps and will automatically get directions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜