games

banggood 18% OFF Magic Cabin Hat Country LLC HearthSong 15% Off Your First Purchase! Code: WELCOME15 Stacy Adams

Friday, March 9, 2012

facebook - Google News: Facebook details how it built the Location API - ZDNet (blog)

facebook - Google News
Google News
Facebook details how it built the Location API - ZDNet (blog)
Mar 9th 2012, 19:58

Earlier this week, Facebook brought over status update features to apps. Developers now have the ability to let users add friends, location, and share photos directly from apps. The social networking giant today outlined the details behind broadening the Location API. The company says it spent the past year and a half making location tagging universal so that your check-ins can appear on Timeline, and your apps can engage with where you've been and where you want to go next. Eight Facebook engineers built the new location features and the Timeline map, working with the Timeline, Places, mobile, search, and tagging teams.

In August 2011, Facebook killed its Places product, but also rolled out new location features. The company says it focused on making it as easy to share your location, no matter what kind of updates you were posting. To do this, Facebook changed the concept of location from being a specific type of information you broadcast via your mobile phone, to metadata you can add to any Facebook item. This include being able to search for places in the vicinity of your current location.

First, Facebook asks for permission to use the GPS API to fetch your current location. If granted, Facebook divided the globe into a large number of small polygons, and all "places" in the world were stored in memory and indexed to their respective polygons. Unfortunately, this infrastructure restricted you from incorporating location into your Facebook profile. After Facebook starting letting you add location to any content shared on the site, searching for places was much harder to process since you could potentially be searching for any place in the world, irrespective of your current location.

To cope with this huge dataset, rather than indexing a place to a single polygon, Facebook assigned four different polygons of increasing size to each place. All "places" in the world were thus indexed by each of these polygons and also by the first three letters for each word in the place name. Developing the universal search infrastructure allowed Facebook to provide users the ability to search for places on any phone (not just smartphones), improving search quality with location if it's available.

Given a query, places matching the first three letters are fetched and intersected with the list of places in all four polygons containing your current location. Depending on the use case, results can be biased toward places closer to you or provide completely global search. Since the candidate set of places increases significantly in this new system, Facebook stores a large set of features to improve ranking, including check-ins and Likes received by the place as well as the company's best estimate for the opening/closing time for the place. Finally, Facebook runs models to select the most relevant places based on these features.

When Facebook created Timeline, the timeline map (picture above) was integral: it lets you see every place you've checked into, as well as the photos and statuses you uploaded at those places. Unlike most Facebook pages, the timeline map requires fetching every piece of content that the user has created with location, not just the first x chronological items. To manage this data load, Facebook built infrastructure to farm out data fetching to multiple servers. On every page load, a single server fetches the IDs of all pieces of content that can be displayed for the current user, then breaks up this data into smaller chunks, and each chunk is sent in a request to another server to actually fetch the data and do privacy checks. The results from these servers are combined to create the timeline map display.

Here's what Facebook had to say about aggregation algorithms for location pins, which I find the most fascinating:

Building the logic for aggregating pins on the map was another interesting challenge because we wanted to choose an optimal algorithm for aggregation while ensuring that we show as many distinct pins as possible. One of our first, more optimistic options was to aggregate any two points that overlapped, but this would distort the order of the pins. Another option we explored was to always aggregate the pins that are closest to each other to make the solution deterministic, but this turned out to be too slow. Instead, an engineer on our team, Jon McCord, wrote an algorithm to deterministically draw these pins. At any point in time, two pins were aggregated only if they were each other's closest neighbor. This was compared with all other pins to find another pin that satisfied this property. If found, the two pins were aggregated into a single pin. This process was followed until no overlapping pins remained.

Last but not least, Facebook talked about location suggestions. The company created systems that iterate through all the albums uploaded by a user and search the title and location fields for text that could signify the place at which the album could have been taken. The team also built a special flow allowing you to seamlessly tag your existing photos with location and immediately add them to your map.

See also:

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: Donate to Wikileaks.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

No comments:

Post a Comment