I've just discovered geopy while trying to fetch geonames.org services
results with Python.
Yet, I realized that the API only looks for the "postalCodeSearch"
service of geonames.org [1] and there is no way to use the basic
search service [2], which sometimes gives better results, eg [3] vs
[4] (especially if getting the 1st result) + [5] vs [6].
I hacked the lib so that we can pass a resource option to the
geocoders.GeoNames() method.
resource='search' will search the basic service [2], while the default
option (to be coherent with the current API) is to use the
"postalCodeSearch" service.
Patch is available at [7], as well as the rewritten geocoders.py
(based on current SVN version).
Of course, feel free to add it in the API itself or re-code it if you
want, I think it's worth getting it.
Cheers,
Alex.
[1] http://www.geonames.org/export/
[2] http://www.geonames.org/export/geonames-search.html
[3] http://ws.geonames.org/search?q=zurich%20Suisse
[4] http://ws.geonames.org/postalCodeSearch?placename=Zurich%20Suisse
[5] http://ws.geonames.org/postalCodeSearch?q=Cork%20Ireland
[6] http://ws.geonames.org/search?q=Cork%20Ireland
[7] http://apassant.net/home/2007/01/geopy-geonames
> Patch is available at [7], as well as the rewritten geocoders.py
> (based on current SVN version).
Good idea, GeoNames support definitely needed some love. Thanks for
the patch!
--
Brian Beck
Adventurer of the First Order
A little update to the previous patch, so that it now adds geonameId
to results if using the 'search' method
Still available at http://apassant.net/home/2007/01/geopy-geonames
Best,
Alex.
I'm wondering if you plan to integrate this patch for geonames ?
I wrote a script that use it to fetch coordinates from iCal files, and
I'll be happy to release it without including a modified version of
geopy.
Best,
Alex
Sounds like I need exactly your modified python script. For a lot of
global addresses it seems geonames is very good, though not the
postalcodesearch but the general one. Using the link I cannot find the
modified file you mention. Could you please send it to me or am I
missing something obvious here?!
cheers,
Mark
On Jul 21, 10:18 am, "Alexandre Passant" <a...@passant.org> wrote:
> Hi,
>
> I'm wondering if you plan to integrate this patch forgeonames?
> I wrote a script that use it to fetch coordinates from iCal files, and
> I'll be happy to release it without including a modified version of
> geopy.
>
> Best,
>
> Alex
>
> On 3/11/07, Alexandre Passant <a...@passant.org> wrote:
>
> > Hi,
>
> > A little update to the previous patch, so that it now adds geonameId
> > to results if using the 'search' method
>
> > Still available athttp://apassant.net/home/2007/01/geopy-geonames
>
> > Best,
>
> > Alex.
>
> > On 1/5/07, Brian Beck <exo...@gmail.com> wrote:
>
> > > Alexandre Passant wrote:
> > > > I hacked the lib so that we can pass a resource option to the
> > > > geocoders.GeoNames() method.
> > > > resource='search' will search the basic service [2], while the default
> > > > option (to be coherent with the current API) is to use the
> > > > "postalCodeSearch" service.
>
> > > > Patch is available at [7], as well as the rewritten geocoders.py
> > > > (based on current SVN version).
>
> > > Good idea,GeoNamessupport definitely needed some love. Thanks for
On 9/10/07, markdeblois <in...@envisionit.nl> wrote:
>
> Hi Alex,
>
> Sounds like I need exactly your modified python script. For a lot of
> global addresses it seems geonames is very good, though not the
> postalcodesearch but the general one. Using the link I cannot find the
> modified file you mention. Could you please send it to me or am I
> missing something obvious here?!
The files (both diff and .py) are available at
http://apassant.net/home/2007/01/geopy-geonames/
Hope it helps !
BTW, Brian, any chance it will be in next geopy release ?
Best,
Alex
Thanks for the quick response. The link you mention does not contain
the modified geocoders.py (not sure what it does contain). Or am I
supposed to run the diff on it somehow (haven't come across a diff
before). Or is there another place where I can find the altered file?!
Once I have the file up and running, I presume I have to run it
something like:
gn = geocoders.GeoNames(resource='search') ????
I presume this main search will return several results in some cases,
is this something which you have tackled as well?!
thanks again,
Mark
On Sep 10, 9:03 pm, "Alexandre Passant" <a...@passant.org> wrote:
> Hi,
>
> On 9/10/07, markdeblois <i...@envisionit.nl> wrote:
>
>
>
> > Hi Alex,
>
> > Sounds like I need exactly your modified python script. For a lot of
> > global addresses it seemsgeonamesis very good, though not the