Closed (works as designed)
Project:
GeoNames
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2008 at 16:20 UTC
Updated:
9 Nov 2012 at 11:27 UTC
Hi,
I use location/gmap for my nodes.
I use nodes which have lat/lon but sometimes the region or city is not correctly inserted.
Could integration of geonames with location be used for reverse geocoding from lat/lon to city/region/country?
Thanks a lot in advance for your answer!
Greetings,
Martijn
Comments
Comment #1
bdragon commentedIntegration would be nice.
(subscribing)
Comment #2
lyricnz commentedYou can always lookup country/subdivison using code like:
and get results like
How's that? Call the function above, and add information directly to your Location.
Comment #3
mgiffordOk, I can confirm that
geonames_query('countrysubdivision', array('lat' => 47.03, 'lng' => 10.2));Works fine for me but if I have the place name , I was sure I could get other info with
geonames_query('query', "Ottawa").Looking at the API http://www.geonames.org/export/geonames-search.html I thought it would be worth trying
geonames_query('q', "Ottawa")and a few other similar options to see if I could get an array from the API.Any thoughts?
EDIT: Got it with
Comment #4
lyricnz commentedThe simpletest for geonames contains code that exercises all the search functions. That is a good place to look for working code
http://drupalcode.org/project/geonames.git/blob/HEAD:/tests/geonames.all...
http://drupalcode.org/project/geonames.git/blob/refs/heads/6.x-1.x:/test...
Comment #5
mgiffordThanks @lyricnz - very useful to know that this has been done like this. Might be useful to add a pointer in the README.txt about this.
The 'featurecode' seems like an optional component. I really have no idea what that array does. Ahh, wait:
http://www.geonames.org/export/codes.html
Ok, so how would I do a search that's just in Canada?
Comment #6
lyricnz commentedThe 'search' method supports passing a country to limit the result set - see http://www.geonames.org/export/geonames-search.html
You can probably just add country=CA to the query arguments:
http://api.geonames.org/search?q=london&maxRows=10&username=demo&style=f...
(untested, the demo account is out of quota for the day)
This is not the right place to be looking for support.
Comment #7
lyricnz commentedI don't think there's still an issue here?