我使用geoxml3的kmz分支来简单地从kmz文件渲染地理日期。但它效果不佳。地标渲染正常,但我看不到任何叠加。这是我的代码:
$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>
这是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>
两个png文件都包含在kmz中。并且控制台中没有错误或警告。 有人可以帮忙吗?
P.S。抱歉我的英文。