디렉토리에 생성중인 kml 파일이 있습니다.KML 파일에서 KMZ 파일 만들기 C에서 프로그래밍 방식으로
C#에서 프로그래밍 방식으로 모든 파일을 kmz 파일로 그룹화하는 방법이 있는지 궁금합니다. Google 어스에 이름과 설명이 표시됩니다.
감사와 안부,
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