Posted by BWPanda on September 3, 2009 at 6:48am
Jump to:
| Project: | GeoNames |
| Version: | 6.x-1.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I have setup a CCK select list that is populated by a list of country names via GeoNames. I also have two computed fields that I'd like to use to get the select country's latitude and longitude coordinates. The problem is, countryinfo doesn't have coordinates for a country.
I successfully got rough coordinates by halving the distance between the east/west and north/south bounding box values, but for odd-shaped countries, this sometimes places the coordinates off the country (either in the ocean of in a neighboring country).
My question is therefore, how do I get latitude and longitude values for a specific country?
Comments
#1
This module just provides an interface to services, and data, provided by http://www.geonames.org/
If you can indicate a function there that contains this information, great. Otherwise we can't do it.
Perhaps you could use the country-info to get the capital of the country, then geocode that to a lat/long? Please close this ticket if your issue has been resolved (or cannot be resolved). Cheers, Simon
#2
Not sure about a function, but this web service URL gets the info I need: http://ws.geonames.org/search?q=australia&featureCode=PCLI
It's just the country name and the feature code 'PCLI' (which apparently returns only countries...)
Anyway to do this in this module?
#3
Nevermind, I found it:
$result = geonames_query('search', array(name=>'australia', featureclass=>a, featurecode=>pcli));I was trying to use 'countryinfo'. I don't think it'd be a bad idea to add lat/lng to 'countryinfo' though...
Thanks Simon!
#4
The feature class/codes are listed at http://www.geonames.org/export/codes.html - it looks like A.PCLI is a pretty close match.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.