当用户单击网页上的链接时,打开Google Earth并加载特定的KML文件 [英] Open Google Earth and load specific KML file when user clicks link on web page
问题描述
我目前正在一个网站上,该网站可以在Google Maps中显示地图数据,但是也有一个链接可以在Google Earth中显示它.
I'm currently working on a site which displays map data in Google Maps, but also has a link to display it in Google Earth.
要在Google Earth中查看此数据,用户单击链接,下载文件,然后使用Google Earth打开文件.是否有一种方法可以自动执行此操作,以便用户可以单击链接,并在iTunes Earth中自动打开文件(类似于iTunes网上商店)?
To get view this data in Google Earth, a user clicks the link, downloads the file, then opens the file with Google Earth. Is there a method to automate this, so that a user can click the link and the file is automatically opened in Google Earth, similar to the iTunes web store?
我在文档中搜索不多.
推荐答案
不,您不能强迫用户计算机启动这样的应用程序.但是,如果用户希望在具有某些浏览器的特定操作系统中进行设置,则可以自己进行设置.
No, you can't force the users machine to launch an application like that. However, a user can set this up themselves if they wish in certain operating systems with certain browsers.
例如,在Windows中,我将Google Earth与kml和kmz文件扩展名关联.我使用Google Chrome浏览器.当我单击指向kml/kmz文件的链接时,它会按照正常方式下载.然后,在下载栏中,我可以选择始终打开此类型的文件".因此,当我单击指向kml/kmz文件的链接时,该链接会在Google地球中自动打开.
For example, in Windows I have Google Earth associated with the kml and kmz file extensions. I browse using Google Chrome. When I click a link to a kml/kmz file it is downloaded as per normal. In the download bar I can then choose to "Always open files of this type". Thus, when ever I click a link to a kml/kmz file it is automatically opened in Google Earth.
如果一个站点可以强迫"这种行为,那么它不仅会非常烦人,而且还会带来巨大的安全风险.
If a site could 'force' this behaviour not only would it be immensely annoying it would also be a massive security risk.
此外,为什么不只使用基于Web的Google Earth?使用Google Maps Api直接对它进行交互非常简单.
Also, why not just use the web based version of Google Earth? It is pretty simple to intergate it directly using the Google Maps Api.
即:
http://earth-api-samples. googlecode.com/svn/trunk/demos/mapsapi/index.html
http://earth-api-samples. googlecode.com/svn/trunk/demos/mapsapi/beefy.html
这篇关于当用户单击网页上的链接时,打开Google Earth并加载特定的KML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!