获取谷歌地图链接与纬度/经度

jzi*_*hen 25 google-maps

我想获得谷歌地图链接,显示位于纬度/经度的标记中的标题/内容.

所以参数是标题,内容,纬度,经度.结果是这样的链接 https://maps.google.com/?ie=UTF8&ll=xxx,xxx&title=xxx&content=xxx

我搜索谷歌并没有在谷歌API中找到答案,事件.

mra*_*888 92

我尝试使用iframe执行您需要的请求,以显示所需的纬度,经度和缩放的结果:

<iframe 
  width="300" 
  height="170" 
  frameborder="0" 
  scrolling="no" 
  marginheight="0" 
  marginwidth="0" 
  src="https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=es&z=14&amp;output=embed"
 >
 </iframe>
 <br />
 <small>
   <a 
    href="https://maps.google.com/maps?q='+data.lat+','+data.lon+'&hl=es;z=14&amp;output=embed" 
    style="color:#0000FF;text-align:left" 
    target="_blank"
   >
     See map bigger
   </a>
 </small>
Run Code Online (Sandbox Code Playgroud)

  • 这个答案有一个错字。应该是“&amp;z=14”而不是“;z=14” (4认同)
  • @aynaz,“ es”是西班牙语,“ z”是将显示地图的缩放比例 (3认同)
  • 我不知道它对你们所有人来说是如何工作的,但即使使用上述解决方案我仍然遇到错误。刚刚发现在“output=embed”之前需要“&amp;”而不是“;”。因此,示例 src 为:``https://www.google.com/maps?q=52.527995,13.302482&amp;hl=es;z%3D14&amp;&amp;output=embed`` (3认同)

小智 11

上面的答案都不起作用,但这会。

<iframe src="'https://maps.google.com/maps?q=' + lat + ',' + lng + '&t=&z=15&ie=UTF8&iwloc=&output=embed'" />
Run Code Online (Sandbox Code Playgroud)


小智 9

如果你使用js变量,@ vignesh单引号是在线需要的

<iframe src = "https://maps.google.com/maps?q=10.305385,77.923029&hl=es;z=14&amp;output=embed"></iframe>
Run Code Online (Sandbox Code Playgroud)