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

Google maps - longitude and latitude isnt working

Hello,

i hope to get some help i dont know whats wrong.

Situation: After the "new" url i lost the map but got it back. But now i have the problem that i cant download the longitude and latitude for my towns.

Here is the script:

MAIN TAB (I think here is the error but dont know where):

[spoiler]let noRows = NoOfRows('GoogleMaps')-1;

 

for i=0 to $(noRows)

 

          let a=peek('CUSTACCOUNT',$(i),'GoogleMaps');

          let b=peek('Adresa',$(i),'GoogleMaps');

 

Data:

          LOAD

          '$(a)' as [Kupac šifra],

          '$(b)' as Adresa,

          subfield([Response/Placemark/Point/coordinates], ',' ,1) AS longitude,

          subfield([Response/Placemark/Point/coordinates], ',' ,2) AS latitude

          FROM [http://maps.googleapis.com/maps/geo?q=$(b)&output=xml&oe=utf8&sensor=false&key=xxx] (XmlSimple, Table is [kml]);

next i;[/spoiler]

GOOGLE MAP TAB:

[spoiler]

// 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 = 'xxx';

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_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=              '400';

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

];

[/spoiler]

I would appreciate any help i need this tomorrow but have no idea how to solve it

Thank you in advance

5 Replies
Alexander_Thor
Employee
Employee

Hey man,

Yes the old V2 api has now been shut down completly.

In the attached document you will find an version for V3 of the API. It's a bit different but I hope you get it to work.

There is a small javascript macro in there so don't miss that part

Not applicable
Author

Alexander,

Having reviewed your script, where would you expect the key to be placed in an instance were google maps api for business is being used.

Cheers

Kris

Alexander_Thor
Employee
Employee

Hey,

There is no key for Google Maps for Business. You do have a client id, typically gme-xxx, and a crypto key used to generate a signature.

Sadly there is no easy way, that I know of atleast, to generate your signature that has to be supplied for every web service call you do. You would have to Base64 encode it with your key and use the generate signature.

I know some customers has created a aspx/php/whatever page that acts as a middle man. QV sends along the request as usual but to the middle man page instead of google. The middle man signs the request, pass it along to google, gets the result and then passes the result to QV.

qlikpahadi07
Specialist
Specialist

This is really Helpful Thanks

Not applicable
Author

Hi Alexandar,

I couldn't open your qvw . Could you please cut and paste the Google API code here so that I can include that in my qvw to render the Geographic Map.. If possible the step-by-step process to integrate the google map in QV

Thanks

Jasper