Layering radar with Google Map API v3
Asked Answered
C

0

1

The default weather API for Google Maps API v3 is nice, but I need an actual radar loop. I found an example of layering a KML file onto an existing map:

    <script language=JavaScript type=text/JavaScript>

            function loadGoogleMap_FacilityPage() 
            {
                var myLatlng = new google.maps.LatLng(34.921467, -84.107919);
                var mapOptions = {
                  zoom: 8,
                  center: myLatlng,
                  mapTypeId: google.maps.MapTypeId.ROADMAP,
                }
                var map = new google.maps.Map(document.getElementById("google_map"), mapOptions);

                var ctaLayer = new google.maps.KmlLayer('http://mysite.com/southeastradar.kml');
                ctaLayer.setMap(map);
            }
    </script>

But the radar is not being layered. The referenced kml file is located on valid server, and was retrieved from National Weather Service

Help with getting the KmlLayer working is appreciated.

Cordie answered 5/1, 2013 at 16:11 Comment(5)
What does ctaLayer.getStatus() tell you?Inexperience
Nothing at all -- I cleaned up the KML file (added some line returns to make it easier to read, so I could understand it better). After that, the KML layer started working. Should getStatus() show an alert box, or write to the page if there are no problems?Cordie
@Inexperience -- any suggestion on removing the two NOAA logos from the map? Here's the map location so you can see the referenced KML. georgiaoffroad.com/map.html I tried removing the first <folder> section - no luck.Cordie
getStatus returns the status of the KmlLayer. example of its use. Those logos are referenced in the KML somewhere.Inexperience
Ok - got it working, but have a new problem. Opened a new SE question for this. #14175052Cordie

© 2022 - 2024 — McMap. All rights reserved.