Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 如何将svg添加到google地图_Google Maps_Svg - Fatal编程技术网

Google maps 如何将svg添加到google地图

Google maps 如何将svg添加到google地图,google-maps,svg,Google Maps,Svg,我做错了什么?我似乎无法在谷歌地图上添加svg层 这是javascript文件maps.js function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng(-34.397, 150.644), mapTypeId: google.maps.MapTypeId.ROADMAP } var map

我做错了什么?我似乎无法在谷歌地图上添加svg层

这是javascript文件maps.js

function initialize() 
{
      var mapOptions = 
      {
        zoom: 8,
        center: new google.maps.LatLng(-34.397, 150.644),
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      var map = new google.maps.Map(document.getElementById("googleMap"), mapOptions);

      var bounds = new GLatLngBounds(new GLatLng(-34.397, 150.644), new GLatLng(-34.397, 150.644));
      var oldmap = new GGroundOverlay("test.svg", bounds);
      oldmap.setMap(map);
}
这是html文件

<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script>
<script type="text/javascript" src="maps.js"></script>
<body onload = "initialize()">
<div id="googleMap" style="width:80%;height:80%;">
</div>
</body>

“document.createElement”不适用于SVG元素。“document.createElements”是必需的。您必须提供一个附加的“名称空间”参数“”


您是否考虑过使用画布而不是SVG?

document.createElement可能与您所说的document.createElement重复?我的代码中没有这个。我基本上只是调用GoogleMap,然后我只想使用svg在GoogleMaps上添加一个层。我必须使用svg文件。