所以我有幾個(巨大的)KML,我已經成功地轉換成180多個奇怪的谷歌地圖編碼的多邊形/多段線。任何人有任何經驗或想法如何把它們變成適合在iOS4的MapKit上使用的MKPolyline對象?KML - > GPolygon - > MKPolyline?
這裏就是我看現在.....
var sw = new GLatLng(25.8373770496571, -106.645646000733);
var ne = new GLatLng(36.50070452533, -93.50813136878951);
var bounds = new GLatLngBounds(sw, ne);
var mapZoomLevel = map.getBoundsZoomLevel(bounds);
var mapCenter = new GLatLng(31.16904078749355, -100.07688868476126)
map.setCenter(mapCenter, mapZoomLevel);
var polygon1 = new GPolygon.fromEncoded({
polylines: [
{points: "sxw}En~}[email protected][email protected][.......]@T^[email protected]^[email protected]?",
levels: "PBADDCCCDDACDDDDDDDBCB[.......]@EGFDEFDEDCCCDEDP",
color: "#0000ff",
opacity: 0.7,
weight: 3,
numLevels: 18,
zoomFactor: 2}],
fill: true,
color: "#0000ff",
opacity: 0.4,
outline: true
});
map.addOverlay(polygon1);
此外,如果您最初擁有KMZ,只需在桌面版Google地球應用程序中打開它並將「另存爲」KML即可。 – 2010-08-22 20:08:38