GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Basics of API? How to read and dowload/save the results?  XML
Forum Index -> General
Author Message
JasonAndrews



Joined: 24/01/2013 18:02:00
Messages: 2
Offline

Hi there,
I've got about 2,000 spreadsheet entries with longitude and latitude co-ordinates but no country code so I'm looking for a way to add the country codes to each record.

I stumbled upon geonames today and it looks as if I can submit individual URLs in this format

http://api.geonames.org/countryCode?lat=45.03&lng=8.2&username=demo

and the page then displays a country code.

But how do I "read/save" each page result back into my database??

I have purchased a basic scraper program as I thought I could scrap the results page but the results page contains no html to use as placemarkers so I'm stumped.

I'm not a developer or very technical so I don't know how to use APIs.

Any help gratefully received!
Jason
saphir



Joined: 05/06/2010 22:44:39
Messages: 130
Offline

Hi Jason

If it is an Excel spreadsheet, then this way >>>

1. Somewhere in the Workbook make a DataImport-WebQuery with your sample LatLon

2. In the datasheet comes a macro who goes through every row of data and >>>
- reconstructs the sample query string with the LatLon of this row
- sends the new string to the WebQuery and makes a Refresh
- gets the new result from the reply cell of the WebQuery
- puts the CountryCode in a cell of the data row

Regards

Urs

JasonAndrews



Joined: 24/01/2013 18:02:00
Messages: 2
Offline

Great - thanks for your help. I tried to follow your example. Made it work with individual lines but couldn't work out how to make the macro so got a colleague to write a php script in the end.

Thanks though - Jason
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team