Google maps API KML/KMZ overlay images missing

Posted: April 27, 2011 in Technical

I’ve been doing a bunch of Google Maps API v3 development lately, and I ran into an issue when loading kml layers onto a map. Tracks and points would work great, but any images were coming back as a 404 error. After some research and log watching I discovered the issue. The images for a kml are stored inside a kmz (zipped kml) file. These images are referenced to via a special script at http://www.google.com/mapsatt or maps.google.com/mapsatt.

I found that the API was trying to call
http://www.example.net/mapsatt?id=http://www.example.net/images/test.kmz&f=files/test.png”
instead of
http://maps.google.com/mapsatt?id=http://www.example.net/images/test.kmz&f=files/test.png”

I found this article: http://notes.coldshore.com/google-maps-kmz-overlay-images-missing

I had a few problems with some KML files and some URL’s, so I found another way to do it:

Create an index.php script in a folder called “mapsatt” from the root of your web site. There’s only one line of PHP code necessary:

header(“Location: http://www.google.com/mapsatt?$_SERVER%5BQUERY_STRING%5D”);

Enjoy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s