【发布时间】:2013-06-21 19:58:33
【问题描述】:
我想获取谷歌地图链接,该链接在位于纬度/经度的标记中显示标题/内容。
所以参数是标题、内容、纬度、经度。 结果是这样的链接 https://maps.google.com/?ie=UTF8&ll=xxx,xxx&title=xxx&content=xxx
我搜索了谷歌,但在谷歌 API 中没有找到答案、事件。
【问题讨论】:
-
你要链接还是html代码?
标签: google-maps
我想获取谷歌地图链接,该链接在位于纬度/经度的标记中显示标题/内容。
所以参数是标题、内容、纬度、经度。 结果是这样的链接 https://maps.google.com/?ie=UTF8&ll=xxx,xxx&title=xxx&content=xxx
我搜索了谷歌,但在谷歌 API 中没有找到答案、事件。
【问题讨论】:
标签: google-maps
我已尝试使用 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&output=embed"
>
</iframe>
<br />
<small>
<a
href="https://maps.google.com/maps?q='+data.lat+','+data.lon+'&hl=es;z=14&output=embed"
style="color:#0000FF;text-align:left"
target="_blank"
>
See map bigger
</a>
</small>
【讨论】:
&z=14 而不是 ;z=14
@vignesh 只有在使用 js 变量时才需要单引号
<iframe src = "https://maps.google.com/maps?q=10.305385,77.923029&hl=es;z=14&output=embed"></iframe>
【讨论】:
以上答案都不起作用,但这会。
<iframe src="'https://maps.google.com/maps?q=' + lat + ',' + lng + '&t=&z=15&ie=UTF8&iwloc=&output=embed'" />
【讨论】:
请参阅有关如何使用纬度/经度 here 进行搜索的文档。
对于指定为的位置:+38° 34' 24.00", -109° 32' 57.00
https://maps.google.com/maps?q=%2B38%C2%B0+34'+24.00%22,+-109%C2%B0+32'+57.00&ie=UTF-8
请注意,加号 (%2B) 和度数符号 (%C2%B0) 需要正确编码。
【讨论】:
将其保存在 iframe 中,从对象中动态绑定数据。
"https://www.google.com/maps/embed/v1/place?key=[APIKEY]%20&q=" + content..Latitude + ',' + content.Longitude;
经度和纬度参考。
https://developers.google.com/maps/documentation/embed/guide
注意:[APIKEY] 将在 60 天后过期并重新生成密钥。
【讨论】:
使用查看模式返回没有标记或方向的地图。
下面的示例使用可选的 maptype 参数来显示地图的卫星视图。
https://www.google.com/maps/embed/v1/view
?key=YOUR_API_KEY
¢er=-33.8569,151.2152
&zoom=18
&maptype=satellite
【讨论】:
<iframe src="https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=en&z=14&output=embed" width="100%" height="400" frameborder="0" style="border:0" allowfullscreen></iframe>
将您的替换纬度、经度值分别放在 YOUR_LAT、YOUR_LON 上。 hl参数设置地图语言,z为缩放级别;
【讨论】: