Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Google Maps API

Hello,

I was looking some QV Dashboards and I found that I can insert a map with some information inside. How can I add this kind of object and associate the places with the information?

If anyone has a demo or some code, please let me know.

That will be great.

Thank you very much.

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Morning Juan,

Let check my attahced file.

Regards,

Sokkorn

View solution in original post

26 Replies
Sokkorn
Master
Master

Hi Juan,

To make this happen first you need coordinates (longitude / latitude)  for your location.

See the sample attached file.

Regards,

Sokkorn

Anonymous
Not applicable
Author

Hi Sokkorn,

I'm running at this time the Personal Edition so I can't open that example. I was looking at the table and I realized that I have to create something like that for Colombia.

Now, which option allows me to insert the map as well and associate it with the table

Thank you very much.

Sokkorn
Master
Master

Hi Juan,

Let check my attached file again.

Or try this

SET ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;($#,##0.00)';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='M/D/YYYY';

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

//===========================================================

[Location]:

LOAD

    RowNo()    AS ID,

    Country,

    Locations,

    [Latitude-Degree],

    [Longitude-Degree],

    Latitude,

    Longitude

FROM

[Cambodia Latitude-Longitude v002.xlsx]

(ooxml, embedded labels, table is Sheet1);

//===========================================================

// Google Maps in QlikView

// V0.85.2 - October 1st 2008  © Copyright QlikTech International AB 2008 / AES

// Google Maps Key

// get a key here http://code.google.com/apis/maps/signup.html

gmap_key = 'xx';

max_zoom_level = 17; //maximum value 17

// Variables required for calculating map

// No need to change these

var_pi180=        '=pi()/180';

var_lat_offset=    '0';

var_long_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];

1. Create Scatter Chart

    . Dimension

        - ID

    . Expression

        -Label1: longitude with expression =sum( round (256*pow(2,($(var_zoom)-1)))+( Longitude  *((256*pow(2,$(var_zoom)))/360)) )

        -Label2: lattitude with expression =sum(((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((Latitude)*pi()/180)))/(1-(sin((Latitude)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))))

        - Locations // Pop_up text (no label)

2. Create List Box: maptype

Do let me know, if this one still cannot open the file.

Regards,

Sokkorn

Anonymous
Not applicable
Author

Hello Sokkorn,

I am not able to open the document. Meanwhile I am going to use the code that you suggested.

Sokkorn
Master
Master

Hi Juan,

Let try my script. Don't forget take my excel file and put it together with your qvw file.

Regards,

Sokkorn

Anonymous
Not applicable
Author

Hello,

I was trying to use the code, I have my Excel sheet with Colombia's coordinates but I don't have any Google Maps API Key.

Is that necessary?

Not applicable
Author

Hi

No more necessary, just put in your key anything you want !

JJ

Anonymous
Not applicable
Author

Hello,

I've done everything you told me, with all that code... but I don't have any map in my scatter chart. Why could that happen?

If you can check my app i'll be glad.

Sokkorn
Master
Master

Morning Juan,

Let check my attahced file.

Regards,

Sokkorn