Yahoo Geolocation API To Get Latitude and Longitude

This post is an example for yahoo placefinder.Using which latitude and longitude of the places can be obtained.This could be useful when your application needs to keep track of the places in a database and later display it in the map.Most popularly used google maps,yahoo maps requires latitude and longitude of places.These codes should be helpful to get the latitude and longitude.


 There is no reason for it because google’s geocoder api is also simple but when comes to usage limits per day yahoo gives little more than google.

Technologies Used:

  • Jquery
  • yahoo api
yahoo geolocation api

yahoo geolocation api

Whats special?

Code is so simple ! Requires only a simple ajax call to geocode.




This code echo’s the content as a xml format to the front end.

$search= "".$_POST['location']."";
$xml = simplexml_load_file($search,'SimpleXMLElement', LIBXML_NOCDATA);
echo $xml->asXML();

 INDEX.HTML( Ajax call ):


Webtuts going to make tutorial on google maps API in the upcoming weeks where these latitudes and longitudes will be used in the map.Subscribe us and stay connected.

Thats it ! Any queries leave a comment below.


If you like this post, contribute us by sharing this in your network

  • Guest

    The demo is displaying the longitude as the latitude as well; change this line:
    to:    $(lon).html($(output).find(‘longitude’).text());

  • Anonymous

    Thanks for pointing it out.

  • building a solar panel

    building a solar panel…

    I’m really enjoying the design and layout of your blog. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!…

  • Jeroen van Gijzel

    This API doesn’t seem to work anymore since today, is anyone else familiar with this problem?

    I can see your request to Yahoo gives the same error:

    Warning: simplexml_load_file( [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
    in /home/content/61/8647061/html/demo/geocode/geocode.php on line 3

    Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "; in /home/content/61/8647061/html/demo/geocode/geocode.php on line 3

    Fatal error: Call to a member function asXML() on a non-object in /home/content/61/8647061/html/demo/geocode/geocode.php on line 4

  • Anonymous

    Hey Jeron, Thanks for notifying to me.As you said this API is currently stopped by yahoo.For the latest one implementation you can refer - . Hopefully we does a post with this implementation soon.Subscribe Us for further updates from WEBTUTS

Ver peliculas online