Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

google maps in Qlikview not so simple

Hi Guys,

i'm still new to qlikview

I went tru this tutorails to learn how to add google maps in a qlikview document. However it is not as simple as I thought it would be

I've created a new Qlikview file and copied the map chart to my new qlikview file. However I get the error message no data to display. It can be the internet settings because I connect directly to the internet without a proxy/firewall.

The tutorails load country's as:

Country:

Albania,

Algeria,

Argentina,

Armenia,

Australia,

Austria,

Azerbaijan,

Bahrain,

Suppose I want to load one country for example The Netherlands and zoom in till postcode level. What steps do I need to take to acieve is? I have a Excel list with all the postcode and want to link them to (the google) map, and calculate for example profit per city. Just don't know where to start. execpt trying to understand how to add the google map, that's hopefully a good step.

I've add both the 'google tutorial' and my 'practice sheet'

Hope u can help!

Thanks in advance!

iSam

1 Solution

Accepted Solutions
Not applicable
Author

Hi Sam,

I checked out your map and there are a couple of things you need to know:

1. You didnt change the variables lat and lng in every place, you missed the important part that was the background image. In the properties panel/Colors there's the dynamic image field, here you need to change the variables too.

2. To get rid of the dimension labels, just uncheck the show legend option on the Dimensions tab.

Here's your file corrected, I usually dont rename the latitude and longitude variables, i leave them just as they are so i can copy and paste the tutorial's example without changing anything. I just adjust the color and size expressions to fit my needs.

Hope this helps

Best regards

View solution in original post

20 Replies
Not applicable
Author

Hi

in the GoogleTest app I have seen 2 issues

1)  change the  SET DecimalSep=',';   in   SET DecimalSep='.';

2) go to property/colors panel  then set  Transparency to  0%

It works !

To answer to you question how to display   data on map you need 2  things :

   -  coordinate longitude / latitude  for each location 

   -  a value for each location

I suspect you lack the coordinate ?   If you send me a sample of your address or postcode I can build an app with a geocoder before mapping.

Regards

JJ

Not applicable
Author

This part of the code shows the data you need to make it work:

// Variables required for calculating map
// make sure your code assigns a long and a lat to "longitude" and "latitude" or it won't work

var_pi180=  '=pi()/180';
var_lat_offset= '0';
var_mc2=  '=256*pow(2,$(var_zoom))';
var_mc1=  '=256*pow(2,($(var_zoom)-1))';
var_mid_lat= '=min(latitude)+(1+var_lat_offset)*((max(latitude)-min(latitude))/2)';
var_mid_long= '=min(longitude)+(max(longitude)-min(longitude))/2';
var_zoom=  '=max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( longitude  *((256*pow(2,_zoom_level ))/360)) )-min( round(256*pow(2,(_zoom_level -1)))+( longitude  *((256*pow(2,_zoom_level ))/360)) ) <map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))';
var_maptype= '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 1 ),maptype)';
map_size_x=     '640';
map_size_y=     '400';

SET HidePrefix='_' ;
// Field required for calcualting best zoom level
_zoom_level:
Load RecNo( ) as _zoom_level autogenerate(max_zoom_level);

maptype:
LOAD * INLINE [
    maptype
    roadmap
mobile
satellite
terrain
hybrid
];

If you have the long and the lat and have named them properly then this is basically plug and play. However, without a valid long and lat the code will do nothing.

rotero
Creator
Creator

im really interested in using google map to make a visual representation for sales data..

is there anyone here have a referal for tutotial?i cant open other QVW file because im using Personal Ed .

Hope u could extend to us newbhie your generosity..

TIA..

Anonymous
Not applicable
Author

Hi JJ,

Thanks for your support!!! I really appreciate it

I adjusted the SET DecimalSep='.', and changed the transparency to 0% as you said. However I still get the error ‘no data to display’

I found an Excel sheet with all the coordinates of all the cities in the Netherlands. I’ve loaded that excel file in to qlikview, but shouldn’t there be a link between the to “tables” or between google maps and my excel sheet?

I’ve attached my qlikview file. As you can see the decimal is now ‘.’ And transparency is 0%.

If my file work on your computer that would mean that something is blocking qlikview to access the google maps.

Thanks so far all u’r help!

Cheers!

isam

Anonymous
Not applicable
Author

Hi,

I did a quick scan onyour QV file and find 3 things you need to adjust:

First, you are missing the variable : var_zoom

As you can see in your expression you need this.

Second, your dimension is Country, you don't have that field. Change it to City.

Third, in your expressions you use the field names longitude and latitude, but your fields are called Longitude and Latitude (with a capital)

Hope this helps. Good luck.

Dennis.

Anonymous
Not applicable
Author

Hi Dennis,

Thanks for your help!! I didn’t send the right Qlikview file. And indeed if you don’t have the right dimensions then you of course you can’t get any data.

Qlikview now loads the worldmap, I “only” need to figure out how to get the coordinates right. Can it be that my coordinates from Excel are not correct with the one from google?

Thanks in advance!

Cheers!

iSam

Anonymous
Not applicable
Author

Your gmap_key is empty.

What you need to do is get a Google Maps code

You can do that here:  http://code.google.com/apis/maps/signup.html

Look for : gmap_key = 'xx';   in your script and fill in the Google maps code between the qoutes.

Let me know if this gets you any futher ok?

Dennis.

Anonymous
Not applicable
Author

Hi Guys,

I think I found the problem. Just can’t solve it L. It seems to me that there’s something wrong with the longtitude and langtitude. When I load my excel file with all the longtitude and langtitude data, Qlikview interpetes it as a text. I therefore changed it so it would match with the google map format.

num(Latitude, '##############', '.', ',' ) as Lat,

num(Longitude, '##############', '.', ',' ) as Lng,

Based on the above expression I get the results below:

Normally it should be something like this ( six numbers after the decimal):

The other challenge is that I can’t get The Netherlands as default map.

I tried Replacing ='http://maps.google.com/staticmap?center=' with “=http://maps.google.com/maps/api/staticmap?center=holland,holland&zoom=8&size=640x640&maptype=roadmap&sensor=false” but that doesn’t work.

My last question: Why is it that when adding a dimension to my map it appears to the right and when I do this in the googleTutorial map it does not (something I want).

Hope u can help me out.

Cheers

iSam

Not applicable
Author

Hi Sam,

I checked out your map and there are a couple of things you need to know:

1. You didnt change the variables lat and lng in every place, you missed the important part that was the background image. In the properties panel/Colors there's the dynamic image field, here you need to change the variables too.

2. To get rid of the dimension labels, just uncheck the show legend option on the Dimensions tab.

Here's your file corrected, I usually dont rename the latitude and longitude variables, i leave them just as they are so i can copy and paste the tutorial's example without changing anything. I just adjust the color and size expressions to fit my needs.

Hope this helps

Best regards