• Sign Up
  • Sign In
  • Wide Screen On
  • Information

Geo!Suggest - Yahoo Geocoder's AJAX Interface

Yahoo Geocoding API + AJAX = Geo!Suggest

The most wanted geo service is live - Yahoo released Geocoding API http://developer.yahoo.net/maps/rest/V1/geocode.html. I really likes how it works. It’s impressive. It beats all existing free geocoders - this is for sure. The major benefit of Yahoo Geocoding API is floating precision level in the API response. It means that Yahoo will do all the best to return the most appropriate result or resultset instead of throwing "unable to parse location" error. This is cool, Yahoo is smart enough to suggest me geo information.

I like this feature very much and before embedding it into http://www.mapbuilder.net I decided to created small "Geo!Suggest" tool. It uses AJAX and PHP on the server so it can be easily implemented on number of different applications.

So what is Geo!Suggest? I would like to say it's the visual AJAX interface for Yahoo Geocoding API. It shows exactly what yahoo returns and gives choice for user to select the most suitable result.

Test Cases

Source Code

Geo!Suggest consists of two files:

  • yahoo.geocode.php - html/java script file which talks to the service.yahoo.geocode.php server file and renders geocoding results. This file contains a bunch of JavaScript to make AJAX calls, parse results and display dynamically all necessary information.
  • service.yahoo.geocode.php - php server file which is responsible for communication with Yahoo Geocoding API and transferring results to Geo!Suggest application

Server file can be easily written on any scripting language and using different methods to communicate with Yahoo services. My implementation uses "curl" call, so mostly of all the script will work on *nix environment only.
Rasmus Lerdorf implemented communication with Yahoo API in his GeoCool! application using different approach and you can use his idea to rewrite service.yahoo.geocode.php file in case you do not have "curl" available.

How to install:

  • Put files in the same folder on your webserver. For example "yahoo" folder in your document root;
  • Change 'mapbuilder.net' appid in service.yahoo.geocode.php to your Yahoo's ID.
  • Open browser and go to http://yoursite.url/yahoo/yahoo.geocode.php
  • Hope you've got good results ;)

Feel free to left your comment or suggestion about Geo!Suggest

In case of some problems drop me an email to info@mapbuilder.net.

PS: Probably I will create new section at MapBuilder.net like "labs" and will publish some useful mapping stuff which I've created during MapBuilder.net development. But due to lack of time this is plans for the future.