NetworkLink kml file works in Google earth but not on Google maps (the browser map is just a bare map without any placemarks)

74 views
Skip to first unread message

Aaron E-J

unread,
Dec 13, 2011, 4:16:30 PM12/13/11
to google-map...@googlegroups.com
I have a very simple NetworkLink kml (below) file that has a href tag to an .aspx file that generates dynamic placemarks (with <Placemark id="1">, <name>, <description>, <Point>, <coordinates> as tags).  The NetworkLink kml file works in Google earth but not on Google maps (the browser map is just a bare map without any placemarks) and I’m at a loss as to why.
NetworkLink kml file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <NetworkLink>
        <name>Ticket Map Add-In</name>
        <Link>
            <href>http://66.230.78.217/getKML.aspx</href>
        </Link>
    </NetworkLink>
</kml>
.js that actually shows (or should show but doesn’t) the placemarks on the map:
        window.onload = function () {
            initialize();
        }
        var map;
        var infowindow;
        var service;
        var request;
       
        function initialize() {
            geocoder = new google.maps.Geocoder();
            var startLatLng = new google.maps.LatLng(41.82177, -72.50722);
            map = new google.maps.Map(document.getElementById('map_canvas'), {
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                center: startLatLng,
                zoom: 5
            });
            infowindow = new google.maps.InfoWindow();
           
            var ctaLayer = new google.maps.KmlLayer('http://66.230.78.217/netLink.kml');
            ctaLayer.setMap(map);
        }
Any explanation of a reason why would be greatly appreciated

Aaron E-J

unread,
Dec 13, 2011, 4:22:42 PM12/13/11
to google-map...@googlegroups.com
Link to the page that does not work:
http://66.230.78.217/ResultsGeneral.aspx

Rossko

unread,
Dec 13, 2011, 5:17:08 PM12/13/11
to Google Maps JavaScript API v3
KmlLayer is pickier than Google Earth.
http://66.230.78.217/getKML.aspx
is being served as mime type text/html, try it as described here
http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server

There may be more to it than that, if your KML is being generated on
the fly, KmlLayer is not very patient before timing it out.

Aaron E-J

unread,
Dec 14, 2011, 10:10:43 AM12/14/11
to google-map...@googlegroups.com

Is there any way to customize the time limit (the server is incredibly slow so it is very likely that this is an/the issue).

Joseph Elfelt

unread,
Dec 14, 2011, 10:15:09 AM12/14/11
to Google Maps JavaScript API v3
As a test you could try taking a static version of one of your KML
files, loading it onto Google Sites (fast servers) and trying to
display it from there.
When you get the Google Sites URL to your file, strip the '?' and
everything after it.

Aaron E-J

unread,
Dec 14, 2011, 11:25:11 AM12/14/11
to google-map...@googlegroups.com
I'm begining to think that its a problem with the NetworkLink file.  I can't load any file (kml or aspx) using <NetworkLink><Link><href>... but I can load the same kml file directly in the javascript. 

Rossko

unread,
Dec 14, 2011, 3:30:46 PM12/14/11
to Google Maps JavaScript API v3
> I'm begining to think that its a problem with the NetworkLink file.

Bear in mind it increases the overall latency, fetching (at least) two
consecutive files.

Demos?

Reply all
Reply to author
Forward
0 new messages