Html 如何使用 iframe 在街景模式中嵌入 Google 地图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21560535/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:48:51  来源:igfitidea点击:

How can I embed a Google Map in Streetview mode with an iframe?

htmlgoogle-mapsiframegoogle-maps-api-3

提问by user1729506

When I pull up a Google Map, there is a little gear icon near the bottom-right that allows me to share. It includes finding an embeddable <iframe>. However, once I go into Streetview this gear icon disappears.

当我打开谷歌地图时,右下角附近有一个小齿轮图标,可以让我分享。它包括找到一个可嵌入的<iframe>. 但是,一旦我进入街景,这个齿轮图标就会消失。

How can I embed the streetview version of the map?

如何嵌入地图的街景版本?

采纳答案by Zealot

When you're in the Streeview mode, click on the "link button" next to the print button. You'll have an iframe and a link to customize and preview it.

当您处于街景模式时,单击打印按钮旁边的“链接按钮”。您将拥有一个 iframe 和一个用于自定义和预览它的链接。

回答by fremn

It appears the problem is that the new google maps does not have a way to embed.

看来问题是新的谷歌地图没有嵌入的方法。

If you click on the ?in the bottom right corner while NOT in pano / street view mode you can revert to classic maps

如果您在未?处于全景/街景模式时单击右下角的 ,则可以恢复为经典地图

Then you'll see the link

然后你会看到 链接

from there you can select embed frame.

从那里你可以选择嵌入框架。

回答by Sourab Reddy

its too simple .just go to link below https://developers.google.com/maps/documentation/javascript/examples/streetview-embed

它太简单了。只需转到以下链接https://developers.google.com/maps/documentation/javascript/examples/streetview-embed

copy the html+javascript code into your page and modify the div style (by default it goes full screen) having id= map-canvas

将 html+javascript 代码复制到您的页面中并修改具有 id= map-canvas 的 div 样式(默认情况下它会全屏显示)

now go to the desired street view and copy the latitude,longitude in the url then replace in your code in initialize function latling(latitude,longitude) done!!!! happy to post my first answer stack overflow has answered me so many times

现在转到所需的街景并复制 url 中的纬度、经度,然后在初始化函数 latling(latitude,longitude) done 中替换您的代码!!!!很高兴发布我的第一个答案堆栈溢出已经回答了我很多次

回答by Kevin Cittadini

Since Google changed in the past two years I'll post an answer that shows how to embed Street View with the new Maps.

由于谷歌在过去两年发生了变化,我将发布一个答案,展示如何将街景与新地图嵌入。

  • Enter in Street View Mode with the best view you want
  • Click those "three dots" on the top left corner of the screen

    Dots

  • Click "Share or Embed Image"

  • 以您想要的最佳视图进入街景模式
  • 点击屏幕左上角的“三个点”

    点

  • 单击“共享或嵌入图像”

Embed Image

嵌入图像

  • Click on the tab "Embed Image" and copy/paste the code of the iframe
  • 单击“嵌入图像”选项卡并复制/粘贴 iframe

enter image description here

在此处输入图片说明