将标签添加到Google“通用地图URL"关联 [英] Add label to Google "Universal Maps URL" link

查看:49
本文介绍了将标签添加到Google“通用地图URL"关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在请求中添加任何参数,例如此函数中的一个,以显示打开位置的名称,而不显示坐标?

Is there any parameter I can add to a request such as the one in this function to display a name for an opened location, instead of showing the coordinates?

  url(loc, label) {
      const prefix = "https://www.google.com/maps/search/?api=1&query=";
      url = prefix + `${loc.latitude},${loc.longitude}`;
      return url;
    }

例如,在Apple Maps中使用以下功能中的 label 可以做到这一点:

For example this is possible in Apple Maps with the label in the function below:

    url(loc, label) {
      const latLng = `${loc.latitude},${loc.longitude}`;
      return `maps:0,0?q=${latLng}(${label})`;
    }

推荐答案

Maps URLs for Search only support two parameters; query and the optional query_place_id. There is no label parameter at this time. You can use query_place_id to show a textual name though, and Google specifically recommends this when querying lat/lng coordinates.

请参见以下示例:https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393&query_place_id=ChIJKxjxuaNqkFQR3CK6O1HNNqY

Android意向支持使用标签参数.

希望这能回答您的问题.

Hope this answers your question.

这篇关于将标签添加到Google“通用地图URL"关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆