对于新版本的谷歌地图,为了显示您的地图,您需要通过链接的集成版本,您不能只通过 iframe 内的共享 URL,因为对于经典的谷歌地图来说,这是微不足道的从共享链接转换为 iframe 嵌入 URL,因为它本质上具有相同的 URL 参数,您只需添加一个 output=embed URL 参数,以便 Google 输出嵌入布局而不是桌面站点布局。
所以,我认为你应该使用 Safari 浏览器,因为谷歌地图由于某种原因没有在其中更新。
对于您的情况:您需要处理网址:https://maps.google.es/maps?ll=39.566752,2.649834&spn=0.369997,0.837021&cbll=39.566752,2.649834&layer=c&panoid=86s2yikaJz6n9Ezi7bJmTw&cbp=12,113.38,,0,0&t=m&z=11
这就是我的做法:
$url = $options["url"];
$url = parse_url($url);
$query = array();
parse_str( $url['query'], $query );
$iframe = "<iframe marginheight=\"0\" marginwidth=\"0\" ";
$iframe .= "src=\"https://maps.google.com/maps?f=q";
$iframe .= "&source=s_q";
$iframe .= "&hl=fr";
$iframe .= "&geocode=";
if(isset($query['q'])) $iframe .= "&q=".$query['q'];
$iframe .= "&aq=";
if(isset($query['sll'])) $iframe .= "&sll=".$query['sll'];
if(isset($query['sspn'])) $iframe .= "&sspn=".$query['sspn'];
$iframe .= "&t=m";
$iframe .= "&ie=UTF8";
if(isset($query['hq'])) $iframe .= "&hq=".$query['hq'];
if(isset($query['hnear'])) $iframe .= "&hnear=".$query['hnear'];
if(isset($query['ll'])) $iframe .= "&ll=".$query['ll'];
if(isset($query['spn'])) $iframe .= "&spn=".$query['spn'];
if(isset($query['z'])) $iframe .= "&z=".$query['z'];
if(isset($query['iwloc'])) $iframe .= "&iwloc=".$query['iwloc']; else $iframe .= "&iwloc=";
$iframe .= "&output=embed\">";
$iframe .= "</iframe>";
这会产生类似这样的东西:
<iframe src="https://maps.google.com/maps?f=q&source=s_q&hl=fr&geocode=&aq=&t=m&ie=UTF8&ll=39.566752,2.649834&spn=0.369997,0.837021&z=11&iwloc=&output=embed" marginwidth="0" marginheight="0" scrolling="no" s12546768360786571550="true" replaced="true"></iframe>
它生成的 iframee 只给你谷歌地图选择的区域,你想让谷歌旅游添加这个 iframe:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.es/maps?cbll=39.566752,2.649834&layer=c&panoid=86s2yikaJz6n9Ezi7bJmTw&cbp=12,113.38,,0,0&ie=UTF8&ll=39.566752,2.649834&spn=0.369997,0.837021&t=m&z=11&source=embed&output=svembed"></iframe><br /><small><a href="https://maps.google.es/maps?cbll=39.566752,2.649834&layer=c&panoid=86s2yikaJz6n9Ezi7bJmTw&cbp=12,113.38,,0,0&ie=UTF8&ll=39.566752,2.649834&spn=0.369997,0.837021&t=m&z=11&source=embed" style="color:#0000FF;text-align:left">Agrandir le plan</a></small>
DEMO