-1

I have had google maps working on my websites (different hosts also) or several years. Today for some reason they stopped working.

I was/am using this page as a basis: https://developers.google.com/maps/documentation/javascript/examples/layer-kml

The problem is when I copy that HTML and upload to my server as is, it works fine. But when I download and then upload to my server the KML file (https://googlearchive.github.io/js-v2-samples/ggeoxml/cta.kml) and change the html to reflect it, it doesn't work.

I have tried it on 2 different servers.

Update:

http://www.feztravel.com/testMap1.asp
A direct copy of the example mentioned above, it works

http://www.feztravel.com/testMap2.asp Only difference here is the cta.kml file which is on my hosts server.

Again both servers that I have access to were working 2 days ago.

deano
  • 1
  • 1
  • 1
    Hi deano, please make sure you add an example of the HTML before and after the re-upload. – Gyowanny Pessatto Queiroz Feb 06 '21 at 19:42
  • Most likely your server isn't configured to support KML. – geocodezip Feb 06 '21 at 19:51
  • possibly related question: [Google Maps KML Layer won't read kml](https://stackoverflow.com/questions/42884597/google-maps-kml-layer-wont-read-kml) – geocodezip Feb 06 '21 at 19:51
  • possibly related question: [Why not doesn't Google maps view the kml layout?](https://stackoverflow.com/questions/19501713/why-not-doesnt-google-maps-view-the-kml-layout) – geocodezip Feb 06 '21 at 19:52
  • possibly related question: [Google Earth loads KML 2.2 but not Google Maps](https://stackoverflow.com/questions/14273812/google-earth-loads-kml-2-2-but-not-google-maps) – geocodezip Feb 06 '21 at 19:53
  • thanks so much folks. I have added links above. To me it is starting to seems like a server software update. As i said all was working fine for several years until 1-2 days ago. – deano Feb 06 '21 at 20:19
  • can you add the code to check the status on the ctaLayer? `google.maps.event.addListener(ctalLayer, "status_changed", function() { document.getElementById('kmlstatus').innerHTML = "Kml Status:"+kmlLayer.getStatus(); });` – geocodezip Feb 06 '21 at 21:35
  • I have added that code and get an error "KmlLayer is not defined". Being a novice and concerned I have done it wrong, I have set it up as a jsfiddle https://jsfiddle.net/njb8kLay/ – deano Feb 07 '21 at 11:21
  • Sorry, typo in my code in the comment: `kmlLayer.getStatus()` should be `ctaLayer.getStatus()`. [Working fiddle](https://jsfiddle.net/geocodezip/Lxst7jnw/1/) – geocodezip Feb 07 '21 at 16:17
  • The [second example](http://www.feztravel.com/testMap2.asp) now works for me. – geocodezip Feb 07 '21 at 16:22
  • Please don't edit an answer (unless you find an error in it that you can address), add a comment (or two) or [edit] your question to add more information. – geocodezip Feb 07 '21 at 16:28
  • Ok re fiddle working. 2nd example working, you mean you can see the multi coloured layer as per 1st one ? I just pasted in the file on my server into your fiddle and it gets a "Kml Status:FETCH_ERROR". re-editting answer, no prob, sorry . noob here not sure of the rules. – deano Feb 07 '21 at 16:59
  • You wrote: "re fiddle working. 2nd example working, you mean you can see the multi coloured layer as per 1st one ?" **Yes**, on this link: http://www.feztravel.com/testMap2.asp. – geocodezip Feb 07 '21 at 19:07
  • If you get FETCH_ERROR, then that is accessing a different KML file than the working example: http://www.feztravel.com/testMap2.asp (I see: `Kml Status:OK` on that page). Perhaps you have an old version of the page or KML cached somewhere. [Working fiddle referencing your KML file on your server](https://jsfiddle.net/geocodezip/Lxst7jnw/2/) – geocodezip Feb 07 '21 at 19:11
  • Wow that is fascinating. I checked my tour pages, the original problem, and they are magically working now. I do know that google caches maps. To get around that when testing , a simple query e.g. xx.asp?x=1 gets around it. Thank you so much for your help. – deano Feb 08 '21 at 10:52

1 Answers1

1

I get a 404 error on https://www.feztravel.com/cta.kml.

If that file is really on the server, then the server configuration is incorrect.

You could try renaming it to cta.xml, both on the server and in the page that references it.

The error message on that link explains the issue:

HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. 
If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

See the documentation:

Why won't my KML files download correctly from my web server?
Web servers have to be told what kinds of files they are providing. Some browsers, such as Firefox, will make guesses on the file type. Others, such as Internet Explorer, rely on the web server's MIME Type settings.

For an Apache server, you would include these two lines in httpd.conf:

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

 AddType application/vnd.google-earth.kmz .kmz

For Microsoft's Internet Information Server, you would follow these directions:

IIS Version 6.0:

http://support.microsoft.com/kb/326965 IIS 4.0 and 5.0:

http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/iis/maintain/featusability/mimeiis.mspx
If you manage your own web server, you must change your own configuration.
Otherwise, contact your web site hosting service and ask them to make these changes.

Also: Google Maps KML Layer won't read kml

geocodezip
  • 158,664
  • 13
  • 220
  • 245