Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)

#1 2012-06-18 21:34:25

degt
Member
Registered: 2012-05-15
Posts: 33
Website

KML Layer not showing (map without layer)

Could someone with more experience here tell me what on earth am I doing wrong that the KML Layer is not showing? I see the map but the polyline of the layer is just not showing.

Here is the script code:

var centerGeo = new google.maps.LatLng(9.157103, -79.264761);
var centerMarker = new google.maps.LatLng(9.157103, -79.264761);

$().ready(function() {
    $('#testMap').gmap3(
              { action: 'init',
                  options: {
                      center: centerGeo,
                      zoom: 10,
                      mapTypeId: google.maps.MapTypeId.TERRAIN,
                      mapTypeControl: true,
                      mapTypeControlOptions: {
                          style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
                      },
                      navigationControl: true,
                      scrollwheel: true,
                      streetViewControl: false,
                      icon:
                        {
                            image: "/img/maps/iconEmit.png",
                            shadow: "/img/maps/iconEmitShadow.png",
                            iconsize: [32, 37],
                            shadowsize: [32, 37],
                            iconanchor: [4, 19],
                            infowindowanchor: [8, 2]
                        }
                  }
                },


 { action: 'addKmlLayer', 
   url: '[url]http://www.panamavibes.com/MapIt/Kml/Tocumen_ElLlano_Carti.kml[/url]', 
   options: {
       suppressInfoWindows: false, 
       preserveViewport: true 
   }, 
   tag: 'Tocumen_ElLlano_Carti'
  }
            );

            $('.tools input[type=checkbox]').change(function () {
                var map = $('#testMap').gmap3('get'),
                            kml = $('#testMap').gmap3({
                                action: 'get',
                                name: 'kmllayer',
                                tag: $(this).attr('id')
                              });
        kml.setMap($(this).is(':checked') ? map : null);
    });
});

I checked the KML Layer URL and it downloads a KML file. I also used kmlvalidator.com to validate that same file and it not only shows me the KML file contents but also tells me it validates Okay. So why is it not showing on the map?

Offline

Ads
(server costs 27.50€ per month)

#2 2012-06-18 22:02:01

charlietfl
Moderator
Registered: 2011-11-24
Posts: 201

Re: KML Layer not showing (map without layer)

what happens when checkbox code removed?

Offline

#3 2012-06-18 22:48:03

degt
Member
Registered: 2012-05-15
Posts: 33
Website

Re: KML Layer not showing (map without layer)

Same result when I remove the cbox. I tried this code on your JSFiddle page as well and still the map shows no KML regardless of whether the "checkbox" tools code is there or not.

Offline

Board footer

Powered by FluxBB