Browser shows XML code instead of opening KML file

690 views
Skip to first unread message

snahLo

unread,
Aug 18, 2006, 11:06:35 PM8/18/06
to KML Discussions
Hi,

I have created a few KML Files that I'd like to integrate in my WEB-Site.

When clicking onto that link from the Explorer, the code of the KML File is shown (in XML-format as it is), but that KML file does not open Google Earth. When I click "Save Target as.." the explorer save an XML-File?

I am puzzled.

Double-clicking the exact same file on my desktop (local) Google-Earth opens up and displays it all exactly the way I like.

Seems as when I call that file over the internet (off my WEB Server) it does not start Google Earth.
Does my WEB-Server needs some information about what to do with the KML files?

Advice is highly appreciated.
Many thanks.

tekgergedan

unread,
Aug 18, 2006, 11:09:08 PM8/18/06
to KML Discussions

snahLo

unread,
Aug 18, 2006, 11:21:43 PM8/18/06
to KML Discussions
Thank you, very much for your immediate reply (less than 2 Minutes!!!). This must be the answer.

BATKO_RADI

unread,
Aug 19, 2006, 3:52:41 AM8/19/06
to KML Discussions
561856-GoogleEarth-NewFolder.kml

Mastiff

unread,
Sep 24, 2006, 10:43:32 AM9/24/06
to KML Discussions
Wait, how did you do this? Is there some magic in download.php that makes this work?

I followed the instructions in the link two posts above (made a httpd.conf file) and that works for IE, but firefox still opens KML files in a browser window. At least Firefox has been smart enough to let me download the files as KML, which was virtually impossible in IE.

Any ideas?

barryhunter

unread,
Sep 25, 2006, 8:39:17 AM9/25/06
to KML Discussions
the httpd.conf file is the 'main' config file of apache, so you should just be modifing that. If you dont have control of the main config (a shared server for example) then probably the easiest way is to create a .htaccess with the config. Search this bbs for "+MIME +htacess" to find posts containing the whole file to copy/paste

ed_aus

unread,
Sep 26, 2006, 9:11:25 AM9/26/06
to KML Discussions
Ok, what am I doing wrong???

As per instructions, I posted these into into httpd.conf in my local apache server:

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

and... it still doesn't work (I am calling the page via http://localhost/... page.html and I even tried adding AddType). The only thing that changed is insted of opening the whole KML file FF and IE browsers now only show text included in <!CDATA[ ...text.. ]]>

Is there anything else that needs to be changed?

ManoM

unread,
Sep 26, 2006, 1:52:52 PM9/26/06
to KML Discussions
Can you post the KML that is being produced? You might have something else going on.

Also, make sure you have followed all the instructions in this link: 5 KML Server requirements

Make sure that your returning HTTP Response Code 200, and that you have the xml declaration as the very first line.

ed_aus

unread,
Sep 27, 2006, 10:23:16 AM9/27/06
to KML Discussions
Thanks ManoM for the interest!

KML file is just "normal" - and I generated it as "save as" from GE so the syntax should be ok (attached for info).

Here is the code how I link to it:

<a href="doc.kml"> <img src="http://www.google.com/earth/images/google_earth_link.gif"
border="0" /></a>

I noticed interesting thing - if the page is open as a file link (ie C:..page.php) - download is activated. However if I open the page as http://localhost... page.php - the link opens as XML...

Regarding HTTP 200 code, how to check if this is happening? This is what I get from Live HTTP Headers (extension to FF):

http://localhost/.../doc.kml

GET .../doc.kml HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.12) Gecko/20050919 Firefox/1.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/.../new.php
If-Modified-Since: Wed, 27 Sep 2006 13:55:25 GMT
If-None-Match: "f461-34ef-c66151f4"

HTTP/1.x 304 Not Modified
Date: Wed, 27 Sep 2006 14:12:21 GMT
Server: Apache/2.0.55 (Win32)
Connection: Keep-Alive
Keep-Alive: timeout=15, max=98
Etag: "f461-34ef-c66151f4"


But I noticed there is no ref to Content-Type: text/html; or else as with other headers...
614650-doc.kml

barryhunter

unread,
Sep 27, 2006, 11:12:48 AM9/27/06
to KML Discussions
There is no 'Content-Type: text/html;' etc as you have already visited the link, so there is nothing new to download!

To get it to work via localhost, you need to make sure you add the mime types to your server config. I think you said you using apache, so you need to add two lines to http.conf (look for other AddType lines and put it there, not just anywhere as you might put it in a virtual host) you will need AddType prefixing the lines. Remember to restart apache after making hte changes.
Reply all
Reply to author
Forward
0 new messages