Morten
unread,Mar 16, 2011, 4:14:26 AM3/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
Hi All,
I have a KMZ file with a KML file (wms.kml) and a PNG file
(layer_0.png) in the root of the KMZ archive.
The KML file holds a <GroundOverlay> element with a <href> inside an
<Icon> element. If I use an absolute (http) reference in the <href>
element for a given image, this image is displayed as an overlay on
the map using google maps API.
However, if I use a relative reference to the image file inside my KMZ
(the PNG file) nothing is displayed.
The <GroundOverlay> element of KML file looks like this:
<GroundOverlay>
<name>sf:roads</name>
<drawOrder>0</drawOrder>
<Icon>
<href>layer_0.png</href>
<viewRefreshMode>never</viewRefreshMode>
<viewBoundScale>0.75</viewBoundScale>
</Icon>
<LatLonBox>
<north>44.50217406961571</north>
<south>44.372889723061675</south>
<east>-103.62268570673663</east>
<west>-103.87779468339123</west>
</LatLonBox>
</GroundOverlay>
My code is:
var c = new google.maps.LatLng(44.37499724,-103.76320682);
var myOptions = {zoom: 11, center: c, mapTypeId:
google.maps.MapTypeId.ROADMAP }
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var ctaLayer = new google.maps.KmlLayer('http://[MYSERVER]/[PATH/TO/
MY/KMZ]');
ctaLayer.setMap(map);
The KMZ file with the relative reference works fine using Google Earth
- but for some reason it doesn't work using the Google Maps API.
Can somebody please tell me why? - And if can change something to make
it possible to display images embedded in a KMZ archive using relative
references?
Thanks,
Morten