IONIC2 Native Google Maps KML


#1

Hi,

I’m using IONIC2 with android and the cordova google maps plugin, which is great, to show an overlay from a KML file.

I can get the overlay to show up and touching markers will show me their information but the callback function never seems to execute.

Here’s the code I’m using

this.map.addKmlOverlay({'url': "myURL"},

                    function(kmlOverlay) {  
                    console.log("overlay");
                    
                    kmlOverlay.on(GoogleMapsEvent.OVERLAY_CLICK, function(overlay, latLng) {
                      
                      if (overlay.type == "Polygon") {
                        overlay.setFillColor("green");
                        console.log('polygon');
                      }
                      
                      if (overlay.type == "Polyline") {
                        overlay.setColor("green");
                       console.log('polyline');
                      }
                      
                      if (overlay.type == "Marker") {
                        overlay.showInfoWindow();
                          console.log('marker');
                      }
                      
                    });
                  });

None of my log statements ever execute.

I have seen previous issues about this but I couldn’t find a working solution.