I am am trying to get the floor plans for our various buildings imported into 4 separate KML files, one for each floor level so that I can toggle them with javascript. I'm able to overlay our floor plan images and properly scale them in Google earth, but once exported the KML doesn't display properly.

Please take note that whatever the orientation of the Google map is, I can't get my overlays to display properly. On the actual API based map, I have it set to be oriented with West at the top instead of North, which seemingly throws us another curve ball, as when I attempt to load the KML per the API's docs and refresh the API based map, I end up with nothing but "There are no images for this zoom level."


<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"     xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<name>Untitled Image Overlay</name>

My API v3 Javascript:

<script type="text/javascript">
    function initialize() {
        var options = {
            center: new google.maps.LatLng(37.22090,-93.26371),
            zoom: 18,
            minZoom: 18,
            maxZoom: 21,
            mapTypeId: google.maps.MapTypeId.SATELLITE
        var map = new google.maps.Map(document.getElementById("map_canvas"), options);

        //here's where it breaks!!!
        //it just won't load the kml...or it is and just breaks beyond reason!
        var ctaLayer = new google.maps.KmlLayer('test.kml');

Here's what it looks like in Google earth (correct):


Here's what it looks like in Google maps (for testing only, using it to load the KML...until I also figure out how to get my API based map to even display the layer without breaking):


Does anyone here have any idea what I need to do to get the display working properly, with regular google maps and more importantly my API based google map?


Please check the Limitations of KML/KMZ on Google Maps API:

Google Maps supports the following KML elements (that is, KML queries in the Search box and GGeoXml objects in the Maps API):

Descriptive HTML
    Entity replacement via <BalloonStyle> and <text> 
KMZ (compressed KML, including attached images)
Polylines and polygons
Styles for polylines and polygons, including color, fill, and opacity
Network links to import data dynamically
Ground overlays and screen overlays

This list does not apply to Google Earth's export to Google Maps, My Maps import, or My Maps export to Google Earth.

The KML parser generally silently ignores XML tags it does not understand.

Google Maps currently has specific limitations to the size and complexity of loaded KML files. Below is a summary of the current limits:

Note: these limits are temporary and are subject to change at any time. Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ) 3MB Maximum uncompressed KML file size 10MB Maximum number of Network Links 10 Maximum number of total document-wide features 1,000

| improve this answer | |
  • You need to have 4 different images for the rotation to work on the Google Maps API. or use code.google.com/p/jqueryrotate – Mapperz Jan 24 '12 at 19:13
  • I shouldn't have to make a different image for each zoom level and direction, now should I? If this is the case, is there an example somewhere? This is a real pain! – ilikenwf Jan 24 '12 at 19:44
  • XML Parsing Error: not well-formed Location: evangel.edu/apps/test/matt/map/test.xml Line Number 18, Column 2:</xml> -^ – Mapperz Jan 24 '12 at 20:15
  • That's actually fixed, but ... still nothing. – ilikenwf Jan 24 '12 at 21:17
  • Seems to me that when the map is oriented with West facing up on the screen, that gmaps forces the 45 degree angle and won't display overlays. – ilikenwf Jan 24 '12 at 22:37

Well, you have in your KML file, the rotation tag, which explicity rotate the shape almost 90°.

You should try removing it and you will get the expected result!

| improve this answer | |
  • Close but not quite...I've been playing with that. I've got it working on my API based map (had to put the KML in a public viewable location).. I'm using the 45 degree view as it's the only view I have for this location if I want West at the top of the map... – ilikenwf Jan 24 '12 at 16:55
  • But still, overlays will NOT work on the 45 degree angle view for some reason. – ilikenwf Jan 24 '12 at 17:03
  • have you tried to load your kml file directly in GMaps ? like that : maps.google.com/maps?q=http://yourdomain.tld/your_kml_file.kml – simo Jan 24 '12 at 17:05
  • Yes, I have. It seems the <rotation> tags are doing absolutely nothing... – ilikenwf Jan 24 '12 at 17:26
  • may you provide the full kml to us to make some tests? – simo Jan 24 '12 at 17:37

You can also try using a GroundOverlay object in javascript instead of a KML. Maybe this will give you better results.

Here's an example

var imageBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng(40.716216,-74.213393),
    new google.maps.LatLng(40.765641,-74.139235));

var oldmap = new google.maps.GroundOverlay(
| improve this answer | |
  • Thanks, but I've actually tried that and it doesn't work. – ilikenwf Jan 24 '12 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.