Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
jblomqvist
Contributor II

Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

Hi all,

Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

E.g. I have a table with a list of city names. And I would like to get the X and Y co-ordinates of those cities without having to manually look for it and populate it in some spreadsheet.

5 Replies
mauricewehbe
Contributor

Re: Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

Hi John,

Yes this is possible, but you need to have geolocation service providing you with a data file that will contain the needed elements such:

City, Country, Longitude, Latitude, .....

Check on qlikmarket, google, openstreetmap, maxmind, geonames....

Best

Maurice

hirishv7
Honored Contributor

Re: Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

Luminary
Luminary

Re: Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

X, Y? Map locations are expressed in polar rather than Cartesian coordinates

Re: Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

see this

Table:
LOAD
City
FROM Table;


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

for i=0 to $(noRows)

let b = peek('City',$(i),'Table');

GeocodeResponse:
LOAD
status,
'$(b)' as CustomerCity,
(
[result/geometry/location/lat]) as latitude,
(
[result/geometry/location/lng]) as longitude
FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]);
next i;

Re: Is there a quick way to get co-ordinates (X and Y) of cities if you just have city names?

Community Browser