Google maps 向KML脚本添加图标时出现问题
在使用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
<?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也很有用