0

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.

user3390963
  • 2,313
  • 1
  • 13
  • 12
  • Do you have a public link where I can get a sample of the KMZ file? – geocodezip Nov 12 '14 at 17:16
  • @geocodezip, yep. iwep.wc.lt/components/com_google_map/soil_moisture/soil.zip This file was generated by esa visat – user3390963 Nov 12 '14 at 18:30
  • @geocodezip there are no ideas, as I understand. – user3390963 Nov 13 '14 at 05:17
  • No, all the lack of updates means is I haven't had time to investigate yet. – geocodezip Nov 13 '14 at 12:44
  • [This example of a KMZ file from Google's documentation works](http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/kmz/EtnaEruptionGroundOverlay.kmz) haven't discovered why yours doesn't – geocodezip Nov 23 '14 at 19:54
  • [This example of a PNG overlay of US counties (and mt. etna erupting) in a KMZ file works](http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/kmz/GroundOverlayTest.kmz) – geocodezip Nov 23 '14 at 20:53
  • @geocodezip, I found the problem. Projection.fromLatLngToDivPixel() method returns wrong values for my bounds. For longitude bounds [-180, 180] width in px every time less than 1 (I think that this is a bug). And for latitude bounds [-90, 90] height is too big. This is a projection problem. – user3390963 Nov 24 '14 at 05:48
  • From kml documentation: Specifies the latitude of the north edge of the bounding box, in decimal degrees from 0 to ±90. Specifies the latitude of the south edge of the bounding box, in decimal degrees from 0 to ±90. – user3390963 Nov 24 '14 at 06:10
  • The problem seems to be with the Google Maps Javascript API v3 [fromLatLngToDivPixel method](https://developers.google.com/maps/documentation/javascript/reference#MapCanvasProjection), that is returning pretty much the same x coordinate for -179 and +179. I get `c1 = {x: 375.42221937777776, y: 555.1613876295404};`, `c2= {x: 372.5777777777778, y: 44.83861237045963};` (on my [test page](http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/kmz/soil_mod.kmz)) , which can't be right. – geocodezip Nov 24 '14 at 17:24
  • [jsfiddle demonstrating the issue](http://jsfiddle.net/8Lfc0tb0/) – geocodezip Nov 24 '14 at 19:10
  • Created an issue in the issue tracker ([gmaps-api-issues](https://code.google.com/p/gmaps-api-issues/)) - [issue 7382](https://code.google.com/p/gmaps-api-issues/issues/detail?id=7382) – geocodezip Nov 24 '14 at 19:31
  • looking at your image, it has a lot of empty space. If you tighten down the bounds and clip the image to fit them (rather than covering the whole globe), it should work. – geocodezip Nov 26 '14 at 14:25

0 Answers0