我正在尝试通过 networkcontrollink 使用更新更新 kml 文件我要更新的 kml 文件存储在服务器上,称为 initial_coord.kml。
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<Placemark id="pm123">
<name>point123</name>
<Point>
<coordinates>-95.44,40.42,0</coordinates>
</Point>
</Placemark>
<Placemark id="pm456">
<name>point456</name>
<Point>
<coordinates>-95.43,40.42,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
我加载以更新它的 kml 文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLink>
<name>Update</name>
<Link>
<href>http://localhost/cgi-bin/testF/add_more_coords.py</href></Link>
</NetworkLink>
</kml>
我正在调用的python脚本如下
#!/usr/bin/python
kml= (
'<?xml version="1.0" encoding="UTF-8"?>\n'
'<kml xmlns="http://www.opengis.net/kml/2.2">\n'
'<NetworkLinkControl>\n'
'<Update>\n'
'<targetHref>http://10.10.210.247/initial_coords.kml</targetHref>\n'
'<Change>\n'
'<Placemark targetId="pm123">\n'
'<name>Name changed by Update Change</name>\n'
'<!-- coordinates remain the same -->\n'
'</Placemark>\n'
'</Change>\n'
'</Update>\n'
'</NetworkLinkControl>\n'
'</kml>\n'
)
print 'Content-Type: application/vnd.google-earth.kml+xml\n'
print kml
更新不起作用,我想知道为什么,因为它与谷歌示例非常相似