Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Extensions problem with external JS

Hi All,

I have a little challenge with extensions. I am trying to include the GoogleMaps API. I know the solution on static maps but this is not satisfaying enough for my needs. Therefore I thought about writing my own extension. But for some reason I can't get it working. The below is a simplified extract, which simply loads the JS script from Google and then should create an object based on the Google API. Unfortunately, the execution stops after the alert("in") statement. I believe the latlng object can't be created because the Google Javascript is unknown (although loaded before).

Any ideas? Here is the code...

Qva.AddExtension('GoogleMaps', function() {

var script = document.createElement("script")

script.setAttribute("type", "text/javascript");

script.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=true");

this.Element.appendChild(script);

script = document.createElement("script");

script.setAttribute("type", "text/javascript");

this.Element.appendChild(script);

alert (this.Element.innerHTML);

initialize();

});

function initialize() {

alert ("in");

var latlng = new google.maps.LatLng(48, 8);

alert(latlng);

var myOptions = {

zoom: 4,

center: latlng,

mapTypeId: google.maps.MapTypeId.SATELLITE

};

}



cheers

Florian

Tags (1)
5 Replies
Not applicable

Extensions problem with external JS

Florian

Did you get this working as I have jsut started to look at the same thing?  I don't really understand javascript at the moment so i'm learning it as i go along

Regards

Lewis

Not applicable

Extensions problem with external JS

Here's a sample of integrating Google Maps JavaScript v3 API into QlikView.

http://andpointsbeyond.com/2011/06/24/qlikview-google-maps-javascript-v3-integration/

Not applicable

Extensions problem with external JS

Jay

Thats brilliant thanks - that will give me something to work from - next stop Dummies guide for JavaScript!

Thanks

Lewis

Not applicable

Extensions problem with external JS

Hi,

I get an error when I try to use this.  An image of the map shows fine but when I try to go into properties and select layout or anything an error message pops up with the message Error: 'style' is null or not an object

Any ideas?

Also, once you've got the map, how do you go about showing data points on it?

Thanks,

Emma

Not applicable

Re: Extensions problem with external JS

Hi Jay!

was wondering if you got the map integrated with your datamodel in QV?

would like to dynamically load data points onto the map.

best,

Brad

Community Browser