> nohup _

Using Google Places API in your location-aware application

Google publicly released their Places API today during the Google I/O Developer Conference in San Francisco. This makes it simple to query Google Places information for location-aware applications.

[Screenshot: Google Places API shows Restaurants in Paris]I've coded up a quick demo here. When you load the page, your IP address is passed to GeoLite City, a free GeoLocation database offered by MaxMind. The call returns your latitude, longitude, city, region and country, which is displayed in the top right-hand corner of the page.

The latitude and longitude returned by GeoLite City is in turn passed to Google Places API, which returns the location of restaurants within 500 metres of your own location. (Alternatively, enter the desired latitude and longitude directly.)

City Sample IP address Latitude Longitude
Brooklyn, USA 174.252.5.20 40.6525 -73.9554
Paris, France 213.174.96.20 48.8667 2.3333
Rio de Janeiro, Brazil 189.122.147.147 -22.9 -43.2333
Sydney, Australia 210.193.218.195 -33.8833 151.2167
Beijing, China 124.116.235.209 39.9289 116.3883
Johannesburg, South Africa 41.18.20.20 -26.2 28.0833

Places of worship in Brooklyn

Change the Place type from Restaurant to one of the other types offered by the Places API - for example, Places of Worship. Then change the range from 500 metres to say, 1000 metres, to change the radius of search.

Change the IP address to see how you can jump from one continent to another. Notice how the City, Region and Country information is updated in the top right-hand corner.



Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.