Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

google maps coordinates lookup issue

Hello,

I am having an issue with this script that I found in the shared QVWs that looks up coordinates for "City State Zip" addresses. I was hoping someone could shed some light on the subject because it seems to return incorrect coordinates for some not all of the addresses. I cross verified some of the locations that were incorrect by putting their URLs in the browser and the browser returns the correct longitude and latitude.

Here is the script:


let vCounter = fieldvaluecount('CityState');
for i=1 to $(vCounter) ;
let vExcelFieldValue = FieldValue('CityState',$(i));



set ErrorMode = 0;
sleep 100 ; // server timeout Google

Adresses:
ADD LOAD
$(i) as num,
@1,
@2,
@3 as latitude,
@4 as longitude,
now() as Quand,
'$(vExcelFieldValue)' as CityState,
1 as Top
FROM
[http://maps.google.com/maps/geo?q=$(vExcelFieldValue)&gl=us&output=csv&ie=utf-8&sensor=false&key=$(gmap_key)]
(txt, codepage is 1252, explicit labels, delimiter is ',', msq);
next i ;




Please Help!

Thanks

Marc

1 Solution

Accepted Solutions
Not applicable
Author

Hey Martin,

Thanks for the reply. I think I figured it out. I think it might have been a slow internet connection. I changed the sleep from 100 to 150 and it seemed to do the trick. Could be a coincidence but all is working now.

Thanks again.

Marc

View solution in original post

2 Replies
martin59
Specialist II
Specialist II

Hi,

Remove the line "set ErrorMode = 0;" and describe your error.

This line ignore the failure and continue script execution.

Martin

Not applicable
Author

Hey Martin,

Thanks for the reply. I think I figured it out. I think it might have been a slow internet connection. I changed the sleep from 100 to 150 and it seemed to do the trick. Could be a coincidence but all is working now.

Thanks again.

Marc