我已将 Google 地图 API 嵌入到我的 Google 站点中,但无法将 KML 图层嵌入其中。我想知道是否有人可以帮助我编写代码。
以下是适用于嵌入式小工具的代码:
<iframe
width="1200"
height="900"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/view?key=AIzaSyC3UDHvPat9pP5JH19ICl4agjWaNnTiNkI
¢er=33.701923, -86.851167
&zoom=7
&maptype=roadmap">
</iframe>
这是我尝试嵌入的 KML 层的代码:
var layer = new google.maps.KmlLayer({
driveFileId: "0B4CQLXiFWdl2OVV6STI5b1BLSUE"
});
我已经尝试了所有方法,但我不断收到代码错误。非常感谢任何帮助!
***回复回答:
在发布我的问题之前,我确实查看了该页面,但我不确定如何在我的 Google 网站上的 Google 小工具中使用该 HTML 代码。我试过了,但它不起作用。我放在上面的初始代码变成了这样:
<img src="https://www.google.com/chart?chc=sites&cht=d&chdp=sites&chl=%5B%5BGoogle+Gadget'%3D20'f%5Cv'a%5C%3D0'10'%3D1199'0'dim'%5Cbox1'b%5CF6F6F6'fC%5CF6F6F6'eC%5C0'sk'%5C%5B%22Include+gadget+(iframe)%22'%5D'a%5CV%5C%3D12'f%5C%5DV%5Cta%5C%3D10'%3D0'%3D1200'%3D897'dim'%5C%3D10'%3D10'%3D1200'%3D897'vdim'%5Cbox1'b%5Cva%5CF6F6F6'fC%5CC8C8C8'eC%5C'a%5C%5Do%5CLauto'f%5C&sig=iWHUUzTOFEKRgAUogMaGWUuybBY" data-igsrc="http://0.gmodules.com/ig/ifr?mid=0&synd=trogedit&url=http%3A%2F%2Fwww.gstatic.com%2Fsites-gadgets%2Fiframe%2Fiframe.xml&up_iframeURL=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fview%3Fkey%3DAIzaSyC3UDHvPat9pP5JH19ICl4agjWaNnTiNkI%0A%26center%3D33.701923%2C+-86.851167%0A++%26zoom%3D7%0A++%26maptype%3Droadmap&w=1200&h=900" data-type="ggs-gadget" data-props="height:900;igsrc:http#58//0.gmodules.com/ig/ifr?mid=0&synd=trogedit&url=http%3A%2F%2Fwww.gstatic.com%2Fsites-gadgets%2Fiframe%2Fiframe.xml&up_iframeURL=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fview%3Fkey%3DAIzaSyC3UDHvPat9pP5JH19ICl4agjWaNnTiNkI%0A%26center%3D33.701923%2C+-86.851167%0A++%26zoom%3D7%0A++%26maptype%3Droadmap&w=1200&h=900;mid:0;spec:http#58//www.gstatic.com/sites-gadgets/iframe/iframe.xml;up_iframeURL:https#58//www.google.com/maps/embed/v1/view?key=AIzaSyC3UDHvPat9pP5JH19ICl4agjWaNnTiNkI &center=33.701923, -86.851167 &zoom=7 &maptype=roadmap;width:1200;" width="1200" height="900" style="display:block;text-align:left;margin-right:auto;" class="igm">
那么没有办法在其中放置一个 KML 层吗?