Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

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!

share|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
show 3 more comments

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

share|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
show 2 more comments

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(
    "http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg",
    imageBounds);
share|improve this answer
    
Thanks, but I've actually tried that and it doesn't work. –  ilikenwf Jan 24 '12 at 19:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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