在传单地图中使用KMZ文件 [英] Using KMZ file in Leaflet Map

查看:183
本文介绍了在传单地图中使用KMZ文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在我的传单地图中使用KMZ文件.我在Leaflet Maps中找到了使用KML文件的优秀插件和教程,但是找不到使用 KMZ 文件的方法.

I have to use KMZ files in my Leaflet Map. I found good plugins and tutorials to use KML files in Leaflet Maps but couldn't find a way to use KMZ files.

使用KML的插件之一是: Leaflet-Omnivore . 对于KML,我要做的就是(我的传单地图在我的ExtJs应用程序中):

One of the plugin for using KML is : Leaflet-Omnivore. For KML all I have to do is(My Leaflet Map is in my ExtJs Application) :

var myMap =  Ext.ComponentQuery.query("leaflet")[0];
myMap.getMap().addLayer(omnivore.kml('http://url/doc.kml'))

有人可以指导我如何在Leaflet中使用KMZ而不是KML吗?

Can any one guide me about how to use KMZ instead of KML in Leaflet?

如果不可能,那么有没有办法使用JavaScript将KMZ转换为KML?

If it is not possible then is there a way to convert KMZ to KML using JavaScript?

推荐答案

KMZ文件只是压缩的 KML文件,可能还带有关联的嵌入式图像,图标等.

A KMZ file is just a zipped KML file, possibly with associated embedded images, icons, etc.

因此,任何支持KMZ文件的程序都会在内部将其解压缩以访问其KML文件.

So any program that supports KMZ files internally unzips them to access their KML files.

这可能是为什么一旦实现KML支持,许多开放源代码程序就不会打扰支持KMZ的原因:您只需要使用您选择的其他解压缩库,即可将KMZ转换为KML.

That may be a reason why many open source programs do not bother supporting KMZ once KML support is implemented: you just need to use an additional unzipping library of your choice, to convert the KMZ to KML.

链接的帖子提供了一些基于JavaScript的解压缩解决方案.

The linked posts give some JavaScript-based solutions for unzipping.

这篇关于在传单地图中使用KMZ文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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