ãgoogle earthã§è¡¨ç¤ºããå³ã¯ãªãã¯ãã¦ãªã³ã¯ã¢ãã¬ã¹ãã³ãã¼ãã¦ããã®URLã®ä¸ã®ãoutput=nlãããoutput=kmlãã«å¤æ´ãã¦ã¢ã¯ã»ã¹ããã¨kmlãã¡ã¤ã«ããã¦ã³ãã¼ãããã¾ããâã®ããã°ã©ã ãkml2csv.jsã¨ããååã§ä¿åãã¦ãããã«âã®KMLãã¡ã¤ã«ããã©ãã°ï¼ãããããã¦ãã ãããååã®CSVãã¡ã¤ã«ã«å¤æããã¾ãã
â»ãgoogle earthã§è¡¨ç¤ºããæ¼ãã¦ãã¦ã³ãã¼ããããKMLã§ã¯ãå¤æã§ãã¾ããã
â»jsãã¡ã¤ã«ãé¢é£ä»ãããã¦ãªãã¨ãå®è¡ã§ããªãããããã¾ããã
â»å¤æã§ããªãå ´åããã£ãã®ã§ä¿®æ£ãã¾ããã2010.1.17
var input; var output; input = WScript.Arguments(0); output=input.replace(".kml",".csv"); var fs = new ActiveXObject ("Scripting.FileSystemObject"); var outf = fs.CreateTextFile (output, true); var xmlDoc = WScript.CreateObject("MSXML.DOMDocument"); xmlDoc.load(input); var wpts = xmlDoc.documentElement.getElementsByTagName("Placemark"); outf.WriteLine("lat,lon,name,snippet,description"); for(var i = 0; i<wpts.length;i++){ var names = wpts[i].getElementsByTagName("name"); if(names.length>0 && !!names[0].childNodes[0]) var name = names[0].childNodes[0].text; var snippets = wpts[i].getElementsByTagName("Snippet"); if(snippets.length>0 && !!snippets[0].childNodes[0]) var snippet = snippets[0].childNodes[0].text; var descriptions = wpts[i].getElementsByTagName("description"); if(descriptions.length>0 && !!descriptions[0].childNodes[0]) var description = descriptions[0].childNodes[0].text; // descriptionã®ã¿ã°ãæ¶ãããæã¯ããã¡ãâ // if(descriptions.length>0 && !!descriptions[0].childNodes[0]) var description = descriptions[0].childNodes[0].text.replace(/\r?\n/g, "").replace(/,/g," ").replace(/<("[^"]*"|'[^']*'|[^'">])*>/g," "); var points = wpts[i].getElementsByTagName("Point"); if(points.length>0 && !!points[0].childNodes[0]) var point = points[0].childNodes[0].text.split(","); outf.WriteLine(point[1]+","+point[0]+","+name+","+snippet+","+description); }//for i outf.Close();