ディレクトリに生成しているkmlファイルがあります。KMLファイルからKMZファイルを作成するC#でプログラム的に作成
C#ですべてをプログラムでkmzファイルにグループ化する方法があるのだろうかと思います。 Google Earthに名前と説明が表示されます。
おかげで、よろしく、
private static void combineAllKMLFilesULHR(String dirPath)
{
string kmzPath = "outputULHR.kmz";
string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string rootKml = appPath + @"\" + dirPath + @"\doc.kml";
Console.WriteLine(appPath + @"\"+ dirPath);
String[] filepaths = Directory.GetFiles(appPath + @"\" + dirPath);
using (ZipArchive archive = ZipFile.Open(kmzPath, ZipArchiveMode.Create))
{
archive.CreateEntryFromFile(rootKml, "doc.kml");
foreach (String file in filepaths)
{
Console.WriteLine(file);
if(!file.Equals(rootKml))
archive.CreateEntryFromFile(file, Path.GetFileName(file));
}
}
}
感謝。 kmzファイルが作成されている間は、doc.kmlファイルの内容しか表示されません。また、私がアーカイブしたい多くのkmlファイルを持っている場合、これは動作します。私は使用している方法でオリジナルの投稿を更新しました。 – nader