Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

ashishbhuyekar
New 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
Partner
Partner

Re: Using Google API to get the lat & long details

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

Highlighted
ashishbhuyekar
New Contributor III

Re: Using Google API to get the lat & long details

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