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
Comment #1
lyricnz commentedThis 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
Comment #2
Anonymous (not verified) commentedNot 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?
Comment #3
Anonymous (not verified) commentedNevermind, 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!
Comment #4
lyricnz commentedThe feature class/codes are listed at http://www.geonames.org/export/codes.html - it looks like A.PCLI is a pretty close match.