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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Google Maps API not working

Hi I have the following code but it doesn't seem to work and gives an error: "Download Failed"

[Location]:

LOAD loc_id,

     area,

     city,

     country

FROM

[..\POC Data & Schema\Citi_2nd_POC_Data_19_Jan\location_dim.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

let noRows = NoOfRows('Location')-1;

for i = 0 to $(noRows)

  let a = peek('loc_id',$(i),'Location');

  let b = peek('area',$(i),'Location');

  let c = peek('city',$(i),'Location');

  let d = peek('country',$(i),'Location');

  Data:

  LOAD

  '$(a)' as location_id,

  '$(b)' as locArea,

  '$(c)' as locCity,

  '$(d)' as locCountry,

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

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

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

next 

Can anybody help me troubleshoot the error?

1 Reply
Anvesh
Contributor III
Contributor III

Hi Vinayak,

Try below code. It works for me.

Data:

  LOAD

  '$(a)' as location_id,

  '$(b)' as locArea,

  '$(c)' as locCity,

  '$(d)' as locCountry,

  ([result/geometry/location/lat]) as latitude,

    ([result/geometry/location/lng]) as longitude

  FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(c)&sensor=false] (XmlSimple, Table is [GeocodeResponse]);

next i;