Render kmz file data on google map with geoxml3

1.9k views Asked by At

I use kmz branch of geoxml3 to simple render geo date from kmz file. But it works not well. Placemarks are rendering fine, but I cant see any overlays. This is my code:

    $doc->addScript($this->baseurl.'/components/com_google_map/assets/ZipFile.complete.js', 'text/javascript');
    $doc->addScript($this->baseurl.'/components/com_google_map/assets/geoxml3.js', 'text/javascript');
    $doc->addScript($this->baseurl.'/components/com_google_map/assets/ProjectedOverlay.js');
    <script type="text/javascript">
        google.load("earth", "1");
        var myMap;
        var minZoomLevel = 3;
        var geoXml;
          function initialize() {
            var mapOptions = {
              center: new google.maps.LatLng(55.01, 82.85),
              zoom: 8,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            myMap = new google.maps.Map(document.getElementById("map_canvas"),
                mapOptions);
            geoXml = new geoXML3.parser({map: myMap, afterParse: showGeoData});
            geoXml.parse('/components/com_google_map/soil_moisture/soil.zip');
          }
          function showGeoData(doc) {
                console.log(doc);
                geoXml.showDocument(doc);
        };
    </script>

And this is kml:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
  <name>Soil_Moisture</name>
  <description>Retrieved soil moisture value
SM_OPER_MIR_SMUDP2_20120916T130233_20120916T135546_551_001_1</description>
  <GroundOverlay>
    <name>Raster data</name>
    <visibility>1</visibility>
    <LatLonBox>
      <north>90.0</north>
      <south>-90.0</south>
      <east>180.0</east>
      <west>-180.0</west>
      <rotation>0</rotation>
    </LatLonBox>
    <Icon>
      <href>overlay.png</href>
    </Icon>
  </GroundOverlay>
  <ScreenOverlay>
    <name>Legend</name>
    <Icon>
      <href>legend.png</href>
    </Icon>
    <overlayXY x="0" y="1" xunits="fraction" yunits="fraction" />
    <screenXY x="0" y="1" xunits="fraction" yunits="fraction" />
  </ScreenOverlay>
</Document>
</kml>

Both of png files were included at kmz. And there are no errors or warnings in console. Could anyone help?

P.S. Sorry for my english.

0

There are 0 answers