Hello. For a project I'm working on I needed proximity based searching based on an area code. My first reaction was to look into Google's geocoding service, but it seems the TOS requires a google map to be displayed that uses the coordinates. Yahoo's placefinder does not seem to have this restriction. When I couldn't find any modules to do this for me I decided to wrap it up in a module, until @fillerwriter suggested I contribute to the geocoder project.

Included is a patch, and two files.
The patch contains hook_menu that places the settings page at admin/config/content/geocoder, there you can set your Yahoo api key.

The Yahoo handler uses a drupal_http_request to GET geo information from yahoo's service. I didn't see a place in the framework for it to return any reverse look up info like city etc, but I did react to $return=point specifically by creating a new Point() object.

Let me know what you think. Thanks!

Comments

patrickavella’s picture

StatusFileSize
new2.29 KB

Added some much needed error checking, and added an explicit call to load geoPHP, I'm not sure why it was working before without it.

patrickavella’s picture

StatusFileSize
new2.32 KB

I was a bit hasty with that file, apologies. I just learned I can't delete my posts or files, but this one should work.

I'm now seeing that there are two versions of geoPHP. The one by fragility looks like it has some yahoo support. Which version is being used? It looks like I could have just called geoPHP to query yahoo.

camidoo’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested, works great!

I would love to see this patch get into a release. Was able to geocode ~20k addresses during a RETS import with dRealty. dRealty requires the geocoder module and seeing as google's geocoder api limits you to 1500 requests/call's per day vs. the 50k requests/calls per day from yahoo, this would be a great addition.

Additionally if this is allowed in there is another address geocoder that could be added just as easily: nominatim from OSM, the one hosted by OSM asks that you limit requests to a certain amount per day, however mapquest open has an implementation that they don't limit: http://open.mapquestapi.com/nominatim/

michaelfavia’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Sorry for the delay. Pushed to dev with credit to patrick. Will be in next release after i close a few more of these issues. Playing holiday catchup. If you need a release before I roll one let me know and ill just make it.

Its much easier and faster for me to commit multiple file git patches than manually add an rename the files. (totally not complaining though ill take what i can get :) Youll just get faster review and inclusion form me or another maintainer if you supply a patch thats easy to review. Thanks again.

http://drupalcode.org/project/geocoder.git/commit/f978a98

patrickavella’s picture

Hi Michaelfavia,

Thank you for committing the patch, and thank you for geocoder, it does exactly what I wanted and is so easy to work with.

I'm still on the new side of git patches, I wasn't able to figure out a way to run out a patch that included the new files, it only wanted to give me the diff of the files that were already there. If it is possible to make a patch that includes new files I will definitely figure out how to get it working next time.

Thanks,
Patrick

michaelfavia’s picture

Two easy ways to do this. Checkout the repo liek normal. Modify the files and add your own. add them (all changes. new and modified files) to the git index with git add. Then perform git diff --cached. This gets you a diff of the index to the last commit.

Alternatively you can even git cvommit those changes and perform a diff between the two revisions with git diff REV1 REV2. Youre always welcome to ask in drupal or msg me directly if you want a little help i love patches :).

jaypark’s picture

hi, trying out Placefinder, but doesn't seem to work

have a valid api key and have localhost domain registered with the app. have http://localhost as the callback

will localhost work?
should the callback be something other than the drupal base path?

thanks.