KML link on website works unexpected

66 views
Skip to first unread message

jetteroheller

unread,
Jan 27, 2006, 7:53:04 AM1/27/06
to KML Discussions
I want to put on my web site links to self produced KML files.

The first test showed unecpected results:

When I click on the link to the KML file,
MSIE 6 shows me the XML file on screen.

When I compress with Winzip the KML file and rename the ZIP file to ending with KMZ, a link on the web site to the KMZ file opens as expected Google Earth and shows the location.

Is it possible to make a web link to a KLM file working?

Otherwise, I have to implement the ZIP conversion for ever file.

Robi

unread,
Feb 4, 2006, 11:21:32 PM2/4/06
to KML Discussions
according to Google Earth KML Tutorial, the mime types are

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

make sure you have entered them correctly.

SaschaClaus

unread,
Feb 5, 2006, 12:20:59 PM2/5/06
to KML Discussions
Quote:



I have the same problem. I don't have access to my webserver's configuration files. Any workaround available?

SaschaClaus

unread,
Feb 7, 2006, 11:34:12 PM2/7/06
to KML Discussions
I found a way to make web browsers NOT to open the place marks I send as a text file.

I don't send KML-files anymore, but KMZ files instead. Since they are zipped, the browsers won't display them as text.

To create (zipped) KMZ files on the fly I use phpZIP. The Light version is free and it works - only with Firefox though :-(

IE asks me to open a file named filename.zip(!!) even though the file the webserver sends is named filename.kmz. :-(

tekgergedan

unread,
Feb 8, 2006, 5:31:54 AM2/8/06
to KML Discussions
Can I ask why you dont open the kml files in GE when they are in your harddisk and then save them as kmz?

SaschaClaus

unread,
Feb 9, 2006, 7:55:01 AM2/9/06
to KML Discussions
Because I don't have them on my harddisk. The placemarks are generated dynamically depending on the user's input.

Otherwise doing the conversion manually would be the better solution, you're right.

SaschaClaus

unread,
Feb 9, 2006, 8:58:24 PM2/9/06
to KML Discussions
I generate the placemarks dynamically depending on the user's input.

You are right, if I had the data on my disk, it would be easier to compress them manually. But I want to make the placemark files on the fly.

Jason_Birch

unread,
Feb 9, 2006, 9:26:03 PM2/9/06
to KML Discussions
If you're generating the placemarks dynamically, you could send a content-type header (using the above types) and then stream the KML to them directly...

What kind of server are you on? If you're on Apache and your host has allowed per-directory (.htaccess) configuration, then you may be able to set your own mime types.

Jason

SaschaClaus

unread,
Feb 9, 2006, 10:06:27 PM2/9/06
to KML Discussions
How do I send content-type headers? I'm afraid I am not experienced enough to do this.

Yes, the site runs on Apache. I have to check whether they support directory-wise access control. Is this necessary for sending the content-type headers?

Do I have to use both methods or are they meant as alternatives?

SaschaClaus

unread,
Feb 10, 2006, 8:40:29 AM2/10/06
to KML Discussions
Quote:

If you're generating the placemarks dynamically, you could send a content-type header (using the above types) and then stream the KML to them directly...

What kind of server are you on? If you're on Apache and your host has allowed per-directory (.htaccess) configuration, then you may be able to set your own mime types.

Jason




I'm using a php wrapper now, which sends the content-type header and prints the kml data as a string. Works like a champ and it also has the side effect that the browser won't ask anymore if I want to open or save the file.

Thanks Jason! Your helpful advice brought me on the right way. :-)

kanossa

unread,
Feb 20, 2006, 5:40:55 PM2/20/06
to KML Discussions
Hello,

i'm new in google earth but u can send the content type in php through the use of the next code:

Code:

<?php
header("Content-type: application/vnd.google-earth.kml+xml");
(...)
?>



it work's very well in firefox and ie...

JuanC

unread,
Feb 21, 2006, 5:06:33 AM2/21/06
to KML Discussions
Hi!

Try adding this to the header... it works for me. It makes the browser to open the file in google
Content-Disposition: filename=test.kml
It works when opening the file from IE or firefox but GE has a problem with it and hangs... sorry... if I find a way around I will post again

I found the problem... I was using Asp.net and the Content-Length header was -1. Apparently GE has a problem with it
Juan C

superperu

unread,
Oct 26, 2006, 6:46:35 AM10/26/06
to KML Discussions
Hi

I would like to know the PHP code you used in order to obtain the side effect of getting the browser don't ask anymore if I want to open or save the KML file.
Reply all
Reply to author
Forward
0 new messages