how to open a kml file in internet explorer?

3,062 views
Skip to first unread message

Yuva

unread,
Aug 24, 2009, 6:59:07 AM8/24/09
to KML Developer Support - Google Earth Plug-in
Hi,

Is there a way to open a kml file in internet explorer?

If so, what I suppose to do get the kml content in IE?

thanks in advance!
Yuva

fraser (Earth API Guru)

unread,
Aug 25, 2009, 2:37:57 PM8/25/09
to KML Developer Support - Google Earth Plug-in
Hi Yuva,

Internet explorer is not capable of showing a kml file by itself, you
would need to load the file into the Google Earth, plug-in, Google
Maps, etc.
Also, you can open Kml files in almost any text or xml editor...
What exactly are you trying to achieve?

F.

Yuva

unread,
Aug 26, 2009, 1:23:42 AM8/26/09
to KML Developer Support - Google Earth Plug-in
Thanks for your reply Fraser !

Actually, my requirement is like that my web application is generating
a kml file which should open in internet explorer rather any kml
editor or Google earth.

For your information, I found "parseKml(String kml)" method in google
earth api which would show kml file, but its not working for huge kml
content.

expecting your reply to proceed further :)

Yuva
> > Yuva- Hide quoted text -
>
> - Show quoted text -

shsavage

unread,
Aug 26, 2009, 9:45:54 AM8/26/09
to KML Developer Support - Google Earth Plug-in
Hi Yuva,

Do you want this to happen on the user's browser after you push a
kml file to them? If that's what you want, and you have control over
your web server, then you need to remove the lines in its config file
that define MIME types for .kml files. I use Apache, and in order to
force the kml to open Google Earth on the user's machine (which seems
to be the opposite of what you want), I had to add these lines in the
http.conf file:

AddType application/vnd.google-earth.kml+xml .kml
AddType application/vnd.google-earth.kmz .kmz

So you might look and see if something like this is already present in
your config file, and comment it out. After that, it should open on
the user's browser like a standard .xml file.

-Steve
> > - Show quoted text -- Hide quoted text -

fraser (Earth API Guru)

unread,
Aug 27, 2009, 6:53:52 AM8/27/09
to KML Developer Support - Google Earth Plug-in
Hi all,

Steve's suggestion will work but it will also stop you being able to
serve any Kml or Kmz files correctly.
To reiterate, you can't view a Kml file in IE as it does not support
it - viewing a 'plain text' string is supported and this is what
incorrectly serving the files will achieve.

Yuva, could I ask how you are generating your Kml? Are you building it
dynamically or is it a pre-existing file?

F.

Yuva

unread,
Sep 2, 2009, 5:40:24 AM9/2/09
to KML Developer Support - Google Earth Plug-in

Thanks for your replies !

Sorry for the late reply.

Alternatively, I used google earth api to load the dynamically
generated kml file (which is stored locally in my tomcat/web-apps
folder and open as a pop-up from the browser later).

I used ge.createNetworkLink('') API to load the kml file in IE, its
working

please check the below code snippet :

var link = ge.createLink('');
link.setHref('http://localhost:8080/webapp/kml/sample4.kml');

var networkLink = ge.createNetworkLink('');
networkLink.setLink(link);
networkLink.setFlyToView(true);

ge.getFeatures().appendChild(networkLink);


Thanks for your reply!

regards
Yuva
Reply all
Reply to author
Forward
0 new messages