将kml转换为kmz [英] Converting kml to kmz

查看:693
本文介绍了将kml转换为kmz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在vba excel中以编程方式将kml文件转换为kmz文件吗?

通过在Google Earth中打开kml文件,然后转到File-> Save-> Save place,我可以手动将kml文件转换为kmz,这样我就将其转换为kmz文件.

但是我想在vba中以编程方式进行转换,如果我们将输入作为kml进行宏输入,则必须将其转换为kmz文件.

我已经对此进行了探索,我发现了一些转换工具,例如kmlkmz转换器,它将自动执行此过程,但是我应该在vba中执行此操作.因此,请建议是否有人知道这一点.

Does anyone know how to convert a kml file to a kmz file programmatically in vba excel.

I am able to convert kml files to kmz mannually by opening a kml file in Google earth and going to File->Save->Save place as, like this i am converting it to kmz files.

But i want to convert programmatically in vba as, if we give input to macro as kml it should have to convert into kmz file .

I had explored this i found some conversion tools like kmlkmz converter which will does this process automatically but i am supposed to do this in vba .So please suggest if any one know this.

推荐答案

在这里阅读KMZ的结构非常容易: KMZ文件 [ ^ ].如果您的原始KML文件未引用外部文件,则不需要任何支持文件:

这是我链接到的上一网站的摘录:
It is quite easy when you read about the structure of KMZ here: KMZ Files[^]. You won''t be needing any supporting files if your original KML file does not reference external files:

Here an excerpt from the site above I linked to:



  1. 创建一个文件夹,其中将包含您的KMZ文件的内容.为它指定一个描述性名称(例如,buffetthawaiitour).
  2. 将默认的KML文件(doc.kml,或您想给它提供的任何名称)放在此文件夹的顶层.仅包含一个.kml文件. (当Google Earth打开KMZ文件时,它将扫描该文件,在此列表中查找第一个.kml文件.它将忽略存档中所有后续的.kml文件(如果有).如果存档中包含多个.kml文件,则您无法确定将首先找到哪个,因此您只需要包含一个即可.)
  3. 在主文件夹中包含一个或多个子文件夹以收集图像,模型,纹理,声音文件或其他引用的资源在doc.kml文件中.此目录结构的复杂性取决于支持文件的数量以及您对组织的偏好.
  4. 使用相对引用.有关更多详细信息,请参见对外部文件的引用.所有相对路径均始于上述项目1中所述的基本文件夹内.例如,如果KMZ文件VacationJournal.kmz位于桌面上,而其doc.kml文件引用的文件myFavoritePlace.jpg也位于桌面上, doc.kml文件中的href是../myFavoritePlace.jpg.
  5. 请勿对KMZ文件中的任何子文件夹使用.kmz扩展名. .kmz扩展名保留为存档本身的名称.

  1. Create a folder that will contain the contents of your KMZ file. Give it a descriptive name (for example, buffetthawaiitour).
  2. Put the default KML file (doc.kml, or whatever name you want to give it) at the top level within this folder. Include only one .kml file. (When Google Earth opens a KMZ file, it scans the file, looking for the first .kml file in this list. It ignores all subsequent .kml files, if any, in the archive. If the archive contains multiple .kml files, you cannot be sure which one will be found first, so you need to include only one.)
  3. Include one or more subfolders within the main folder to collect images, models, textures, sound files, or other resources referenced in the doc.kml file. The complexity of this directory structure depends on the number of supporting files and your preferences for organization.
  4. Use relative references. See References to External Files for more details. All relative paths begin inside the base folder described above in item 1. For example, if a KMZ file vacationJournal.kmz is on the desktop, and its doc.kml file refers to a file myFavoritePlace.jpg, which is also on the desktop, the href in the doc.kml file is ../myFavoritePlace.jpg.
  5. Do not use the .kmz extension for any of the subfolders within a KMZ file. The .kmz extension is reserved for the name of the archive itself.



问候,

曼弗雷德(Manfred)


Regards,

Manfred


这篇关于将kml转换为kmz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆