Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ashishbhuyekar
Contributor III
Contributor III

Using Google API to get the lat & long details

HI All,

Can anyone help me on how we can get lat long using google API, below is sample API that i am planning to use below API

[https://maps.googleapis.com/maps/api/geocode/xml?address='$(Address)'&key= ]

Any help in this regard will be appreciated.

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

This script should do the trick

/

Addresses:

///////////////replace here the call for your table //////////////////

LOAD City,

     Address,

     ID

FROM

[7ebe9920-7441-4e6c-9a7d-7000be3efc62.xlsx]

(ooxml, embedded labels, table is Sheet1);


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

for i=0 to $(noRows)

  let d=peek('ID',$(i),'Addresses');

  let address=peek('Address',$(i),'Addresses');

 

Data:

LOAD

'$(d)' as ID,

[result/formatted_address] as FormattedAddress,

[result/geometry/location/lat] AS latitude,

[result/geometry/location/lng] AS longitude,

%Key_GeocodeResponse_62C7A0A69859D655

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


next

ashishbhuyekar
Contributor III
Contributor III
Author

Hi Liron,

Thanks for your reply. This is helpful also can you please help me if I can get a lat long if I provide city/town/county as input parameter to this API.

Thanks in advance