2

I'm trying to add a KML network link with the Google Earth API using the same function that I have used for regular KMLs and KMZs. Sources suggest to create a KML with a "Ground Overlay" to connect to the WMS which I have done and displays perfectly well within Google Earth. My problem lies when I attempt to add the same KML with the Google Earth API in my application.

My function to load KMLs & KMZs to the map:

var geoNat1 = new Array(11);
var contNat1 = 0;

function nacional(tip, nombre, numer, obj) {
    contNat1 = numer;
    $j('.cargando').show();
    console.log(nombre);
    if (geoNat1[contNat1] == null) {
        geoNat1[contNat1] = ge.createNetworkLink("");
        geoNat1[contNat1].setDescription("NetworkLink se abre para el contenido recuperado");
        geoNat1[contNat1].setName("Abrir NetworkLink");
        geoNat1[contNat1].setFlyToView(true);
        var link = ge.createLink("");
        link.setHref("http://" + servidor + "/" + directorio + "/carto_ref/" + nombre);
        geoNat1[contNat1].setLink(link);
        ge.getFeatures().appendChild(geoNat1[contNat1]);
    } else {
        if (obj.checked == true) {
            geoNat1[contNat1].setVisibility(true);
        } else {
            geoNat1[contNat1].setVisibility(false);
        }
    }
    $j('.cargando').hide();

}

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>nowCOAST - Tropical Cyclones</name>
    <drawOrder>1</drawOrder>
    <Icon>
        <href>http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/wwa?SERVICE=WMS&amp;REQUEST=GetMap&amp;FORMAT=image%2Fgif&amp;TRANSPARENT=TRUE&amp;STYLES=&amp;VERSION=1.1.1&amp;LAYERS=NHC_TRACK_POLY%2CNHC_TRACK_LIN%2CNHC_TRACK_PT%2CNHC_TRACK_WWLIN%2CNHC_TRACK_PT_72DATE%2CNHC_TRACK_PT_120DATE%2CNHC_TRACK_PT_0NAMEDATE%2CNHC_TRACK_PT_MSLPLABELS%2CNHC_TRACK_PT_72WLBL%2CNHC_TRACK_PT_120WLBL%2CNHC_TRACK_PT_72CAT%2CNHC_TRACK_PT_120CAT&amp;WIDTH=1500&amp;HEIGHT=637&amp;SRS=EPSG:4326&amp;BBOX=-118.867172,14.532850,-86.703392,32.718620</href>
        <refreshMode>onInterval</refreshMode>
        <refreshInterval>3600</refreshInterval>
    </Icon>
    <LatLonBox>
        <north>32.71862</north>
        <south>14.53285</south>
        <east>-86.70339199999999</east>
        <west>-118.867172</west>
    </LatLonBox>
</GroundOverlay>
</kml>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.