-1
所以我試圖編寫一個程序(不需要依賴),它將從Google Maps中讀取KML文件(見下文)以獲得座標並存儲他們在一個矩陣中進行數據處理。比線條讀取(Python中的KML)效率更高
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Driving directions to Commercial St/A1202</name>
<description><![CDATA[]]></description>
<Style id="style1">
<IconStyle>
<Icon>
<href></href>
</Icon>
</IconStyle>
</Style>
<Style id="style2">
<LineStyle>
<color>73FF0000</color>
<width>5</width>
</LineStyle>
</Style>
<Style id="style3">
<IconStyle>
<Icon>
<href></href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>From: Unknown road</name>
<styleUrl>#style1</styleUrl>
<Point>
<coordinates>-0.168942,51.520180,0.000000</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Driving directions to Commercial St/A1202</name>
<styleUrl>#style2</styleUrl>
<ExtendedData>
<Data name="_SnapToRoads">
<value>true</value>
</Data>
</ExtendedData>
<LineString>
<tessellate>1</tessellate>
<coordinates>
-0.168942,51.520180,0.000000
-0.167752,51.520447,0.000000
-0.167371,51.520481,0.000000
</coordinates>
</LineString>
</Placemark>
<Placemark>
<name>To: Commercial St/A1202</name>
<styleUrl>#style3</styleUrl>
<Point>
<coordinates>-0.073247,51.516960,0.000000</coordinates>
</Point>
</Placemark>
</Document>
</kml>
儘管對於上面這樣的小文件來說這不是低效的,但我有500 + KB文件可以在以後解析!那麼對於有效的方法(不涉及「非標準」進口需要安裝)的任何建議,只需獲取這些座標並將它們存儲爲Matrix?
你現有的「低效率」代碼是什麼樣的? – geocodezip
正如我在標題中所述。逐行檢查以查看它是否在座標標記中。然後只要在 coordinates>標籤之前分配值。 – BrownE
我讀了標題。仍然沒有看到任何代碼。 – geocodezip