Current Location - Google Maps - Link to Directions

后端 未结 8 689
长情又很酷
长情又很酷 2020-12-12 16:12

I\'m trying to do what seemed to be an easy thing but has resulted in some confusion. I\'m trying to have a link going to Google Maps with the destination address pre-filled

相关标签:
8条回答
  • 2020-12-12 17:08

    Use My Location instead:

    https://maps.google.com/?saddr=My%20Location&daddr=myDestinationAddress
    

    Current Location only works on OS'es with English locale setup.

    I haven't found any documentation on this. However leaving saddr blank as suggested here https://developers.google.com/maps/documentation/ios-sdk/urlscheme will prompt the user to input start address.

    0 讨论(0)
  • 2020-12-12 17:10

    For those still looking, here are some methods of linking to Google Maps:

    Spaces can be changed to + or encoded as %20.

    • Linking to a location (No directions)

      https://www.google.com/maps?q=760+West+Genesee+Street+Syracuse+NY+13204
      
    • No starting point (User input required to generate directions).

      https://www.google.com/maps?daddr=760+West+Genesee+Street+Syracuse+NY+13204
      
    • With a set location as starting point (Automatically generates directions with no user input required).

      https://www.google.com/maps?saddr=760+West+Genesee+Street+Syracuse+NY+13204&daddr=314+Avery+Avenue+Syracuse+NY+13204
      
    • With "My Location" as starting point (Automatically generates directions with no user input required).

      https://www.google.com/maps?saddr=My+Location&daddr=760+West+Genesee+Street+Syracuse+NY+13204
      
    • Current Location to Latitude and Longitude

      https://www.google.com/maps?saddr=My+Location&daddr=43.12345,-76.12345
      
    • Query search of a Latitude and Longitude. Also shows setting a default zoom level.

      https://www.google.com/maps?ll=43.12345,-76.12345&q=food&z=14
      
    • String search as destination

      https://www.google.com/maps?saddr=My+Location&daddr=Pinckney+Hugo+Group
      

    Here is a post I made that I will keep updated as there are some even newer ways to do this!

    0 讨论(0)
提交回复
热议问题