How to rate Points Of Interest automatically

api, development, google, ideas No Comments »

During my work on SunnyRentals I’ve got a task to add 2 closest airports to every property an owner creates.

I implemented it quite fast since we have a database of airports with coordinates.

While playing with this feature, we found out that it is not good enough — the real task must be to add 2 closest and biggest airports. The problem is that we don’t have any data in airports DB to guess how big or famous a particular airport is.

So we need to rate every airport somehow…

The solution we found was simple — we need to google for the airport name and get the search results count. The count can be considered as rating value — London Heathrow airport has 2.33 million results while Kiev Zhulyany airport has only 0.77 mln which looks fair.

Several things to pay attention to:

  • the query we formed was [city name] + [airport name] + ‘ airport’
  • if this query gives zero result, I omit the city name — at times it hepls
  • we put the query into quotes to google for the exact phrase, otherwise the London City airport gets the highest rating due to the fact that “city” is a general term
  • if the airport name includes the city name (Melbourne Intl), we omit the city name — ”Melbourne Intl airport” is better then “Melbourne Melbourne Intl airport
  • in addition to previous idea — if the airport name sounds like the city name, we omit the city name as well. Example: Narsarsuaq airport in Narssarssuaq city. I used soundex function for this comparison — it’s present in PHP and MySQL.

To get the google results you can use the Google Search API:

$queryTemplate = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%s';
$airportQuery = '"London Heathrow airport"';
$query = sprintf( $queryTemplate, urlencode( $airportQuery ) );
$json = json_decode( file_get_contents( $query ), 1 );
$rating = (int)$json['responseData']['cursor']['estimatedResultCount'];

Google Analytics API launched!

api, google 1 Comment »

This week Google has launched Google Analytics API. Now developers can use the analytical power of Google in their own services.

For example, if you want to access Google Analytics by your phone, use Android application by Actual Metrics. Do you want the Analytics on your desktop? There is a Desktop-Reporting for that purpose.

If you are interested in integration of Google Analytics into your own business, take a look at such examples.

MailChimp integrated Google Analytics to email marketing platform.

ShufflePoint® offers the addition of data from Google Analytics to the presentations of PowerPoint®.

Look at youcalc that have created software that allows you to mix up Google Analytics, AdWords, Salesforce.com and other data companies.

Need more examples? Look at samples from the customers on the Google developers website.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in