[GIS] Google Maps/Google Earth – KML Overlays and Custom Orientation

googlekmlmappingmaps

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."

My KML:

<?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">
<GroundOverlay>
<name>Untitled Image Overlay</name>
<Icon>
    <href>http://img694.imageshack.us/img694/2600/walther.png</href>
    <viewBoundScale>0.75</viewBoundScale>
</Icon>
<LatLonBox>
    <north>37.21924494476235</north>
    <south>37.21876115002708</south>
    <east>-93.2637540015874</east>
    <west>-93.26445522810076</west>
    <rotation>87.56327787656277</rotation>
</LatLonBox>

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,
            heading:-90,
            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');
        ctaLayer.setMap(map);
    }  
</script>

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

http://img811.imageshack.us/img811/6348/gearth.jpg

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):

http://img838.imageshack.us/img838/2237/gmapsr.jpg

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?

Best Answer

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):

Placemarks
Icons
Folders
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