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
Google maps 向KML脚本添加图标时出现问题_Google Maps_Google Maps Api 3_Kml - Fatal编程技术网

Google maps 向KML脚本添加图标时出现问题

Google maps 向KML脚本添加图标时出现问题,google-maps,google-maps-api-3,kml,Google Maps,Google Maps Api 3,Kml,在使用KML和谷歌地图时,我在显示自定义图标时遇到了一些问题。我想显示从图标标签链接到的自定义图标。代码如下: <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://earth.google.com/kml/2.2"> <Document> <Style id="CaliforniaCity"> <IconStyle> <sc

在使用KML和谷歌地图时,我在显示自定义图标时遇到了一些问题。我想显示从图标标签链接到的自定义图标。代码如下:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
     <Style id="CaliforniaCity">
        <IconStyle>
         <scale> 1.0</scale>
          <Icon>
            <href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>
          </Icon>
        </IconStyle>
      </Style>
      <Placemark id=test>
        <name>Test</name>
        <styleUrl>#CaliforniaStyle</styleUrl>
        <Point>
          <coordinates>
            -121.0,38.0,0
          </coordinates>
        </Point>
      </Placemark>
      <Placemark id=test1>
        <name>Test1</name>
        <styleUrl>#CaliforniaStyle</styleUrl>
        <Point>
          <coordinates>
            -121.05,38.10,0
          </coordinates>
        </Point>
      </Placemark>
      <Placemark id=test2>
        <name>Test2</name>
        <styleUrl>#CaliforniaStyle</styleUrl>
        <Point>
          <coordinates>
            -121.10,38.5,0
          </coordinates>
        </Point>
       </Placemark>
</Document>
</kml>

1
http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png
试验
#加州风格
-121.0,38.0,0
测试1
#加州风格
-121.05,38.10,0
测试2
#加州风格
-121.10,38.5,0
我不确定我会错在哪里,因为书中有类似的代码


谢谢

您有一个打字错误CaliforniaCity与CaliforniaStyle不同:

<Style id="CaliforniaCity">

<styleUrl>#CaliforniaStyle</styleUrl>

#加州风格
您的xml也很有用