Google Maps API Email Directional Mail

I used the Google Maps API to create a map with a custom input field that displays directions to a fixed address after the user submits the starting point on the form. Now I would like the user to be able to send a link to Google maps with instructions already included by email or to another person. This functionality already exists on regular Google maps, but I don’t believe that anything was built into the API to reproduce this. Does anyone have any ideas or thoughts?

PS, sorry, I can’t include a link to the site because it is not already running, and I don’t think that my client wants everyone to look at their new site before it is finished :). However, I will try to clarify as much as necessary if someone is confused. Thanks.

+4
source share
2 answers

You can simply create a link filled with your code.

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

This will open for Google Maps and will automatically receive directions.

+1
source

Set rights, you can create the correct URL for the Google Map service, knowing the correct parameters. This resource contains several url formats.

My personal favorite:

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

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

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

Source: https://habr.com/ru/post/1340903/


All Articles