How do I link to Google Maps with a particular longitude and latitude?

前端 未结 15 2225
夕颜
夕颜 2020-12-02 04:49

I have a small application that gives the current location: longitude and latitude. Now I have to browse to google maps with the longitude and latitude. Please suggest how I

相关标签:
15条回答
  • 2020-12-02 05:20

    To open the google maps app in android:-

    geo:<lat>,<lng>?z=<zoom>
    

    open app with marker for give location:-

    geo:<lat>,<lng>?q=<lat>,<lng>(Label,Name)
    

    open google map in ios:-

    comgooglemaps://?q=<lat>,<lng>
    

    open google maps in browser with following parameters:-

    http://maps.google.com/maps?z=12&t=m&q=<lat>,<lng>
    
    • z is the zoom level (1-21)
    • t is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)
    • q is the search query
    0 讨论(0)
  • 2020-12-02 05:23

    Using the query parameter won't work, Google will try to approximate the location.

    The location I want : http://maps.google.com/maps?ll=43.7920533400153,6.37761393942265

    The approximate location (west of the actual location) : http://maps.google.com/?q=43.7920533400153,6.37761393942265

    0 讨论(0)
  • 2020-12-02 05:24

    Open google map and show URL schemes location and location pin

    UIApplication.shared.openURL(URL(string:"https://maps.google.com/?q=\(dicLocation.stringValueForKey("latitude")),\(dicLocation.stringValueForKey("longitude")),15z")!)
    
    0 讨论(0)
提交回复
热议问题