Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QlikView and Google Maps

Hey, I'm working on my final project in QV

and got some problems with definning the maps.

I managed to add the google maps,

but can't actually connect it with my data...

i have a bunch of restaurants and would like to see them on the google map,

please help me, i might have gotten stuck with the script.

that it shows the places but when i press a place on the table

it doesn't show which one it is on the maps,

and shows no information on the map also.

another question is, how do i make a window that shows the site

i have a list of all the sites and still can't manage to open a windon

on the dashboard that shows it.

thanx a lot'

Yotam ziv

this is my google maps script:

//Declare variables for unique divIDs

var r=Math.floor(Math.random()*10001);

var divName = "div" + r;

//Houston - We have lift off.

loadLibs();

// Initilize Marker API - When ready call Google API

// Initilize Google Maps API - When ready get ready to do some voodoo magic!

function loadLibs() {

Qva.LoadScript('http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.1/src/markercl...', function () {

Qva.LoadScript('https://maps.google.com/maps/api/js?sensor=false&callback=Map_Done')

});

};

//Do magic.

function Map_Done() {

    Qva.AddExtension("Map",

        function() {

//Check for existing map canvas.

if (this.Element.children.length == 0) {

var ui = document.createElement("div");

ui.setAttribute("id",divName);

ui.setAttribute("style","width: 100%; height: 100%");

this.Element.appendChild(ui);

}

//Define Map center

var center = new google.maps.LatLng(32.727136, 35.139817);

//Draw map - Change options to suit your needs.

var map = new google.maps.Map(document.getElementById(divName), {

zoom: 8,

center: center,

mapTypeId: google.maps.MapTypeId.ROADMAP

         });

//Create marker array and cycle through your rows.

var markers = [];

        for (var i = 0; i < this.Data.Rows.length; i++) {

var row = this.Data.Rows ;

var latLng = new google.maps.LatLng(row[0].text,row[1].text);

//Example title for pins, adjust to suit your need.

//var mTitle = 'No. Employees: ' + row[3].text + ' Average Monthly Pay: ' + row[2].text;

var marker = new google.maps.Marker({

position: latLng,

//title: mTitle

});

//Push row into array

markers.push(marker);

        }

//Apply markercluster to map - Might want to segment this if you are plotting a huge number of markers.

//Add options to fine-tune performence

var mcOptions = {gridSize: 30, maxZoom: 15};

        var markerCluster = new MarkerClusterer(map, markers, mcOptions);

});

//Not used right now - Used to calculate a different number on the marker

function count(markers) {

     var total = 0;

        for (var i = 0;i < markers.length; i++) {

          total = markers.value;

        }

        var value = total;

        // different index for different icons showed on cluster maker.

        var index = parseInt(value / 30, 10) + 1;

        return {

          text: value,

          index: index

        };

    };      

};

2 Replies
Alexander_Thor
Employee
Employee

That looks like the extension I wrote a while back.

When looking your screenshot it looks like you only have one restaurant selected?

The data exposed to the extension works in the same way as qlikview works so most likely you have more then one set of coordinates related to your restaurant.

Easiest way to try this is to pull out listboxes for restaurant, latitude, longitude. Select a restaurant and you should only get one coordinate set back.

You could probably also remove the marker cluster lib completly, I only had it in there becuse I needed to plot a pretty huge number of markers and wanted to improve performance.

Not applicable
Author

Alexander, thank you so much,

i managed to connect between the coordinates and the Restaurant Name,

so it shows only one Place every time i chose 1.

You startd talking about removing the cluster lib,

unfortunately i don't know much about JAVA,

i'm a little better in C# so i tried something but it didn't work,

would be deliteful if you remove the cluster lib for me

and the map will keep showing...

One last thing for now is,

i tried openning a web page on the screen

but it won't let me,

everytime i chose a place, it asks me to save some file.

the web pages that i want to show are all in a table on the screen( bottom right where the mouse is ),

don't know what to enter in the URL column so the data in this table will be shown on the web page,saving.jpg

i added a photo to show you the situation.

again, thank you so much for being so helpful,

i'll notice it in the project...

Yotam Ziv