If you’re looking for a new job, you might be thinking about the salary, the challenges or the specific company you want to work for, but you’ll definitely be thinking about how long it will take you to get to work every day. Travel time is increasingly important: more than 80% of people in a recent survey on LinkedIn would take a pay cut to get a job with a shorter commute and a five-year study on commuting found that adding another 20 minutes to your daily commute is as bad for job satisfaction as a 19% pay cut. Now LinkedIn is using a range of Bing Maps APIs to help job hunters see how long it would take to get to work so they can decide if they want to make that trade-off.
Set your home location, preferred method of travel and what time you usually leave for work and when you look at a job listing on the LinkedIn mobile app, you’ll see a typical commute time based on the address for the job.
“We had the idea for a while,” LinkedIn software engineering manager Caleb Johnson told us. After Microsoft bought the service, the Bing Maps APIs looked like an ideal way to build the feature. “Bing Maps has world class support and some amazing APIs and there were some new things they were building that we were excited to leverage.”
LinkedIn uses the Bing Maps Autosuggest API to ‘type ahead’ and autocomplete addresses as users enter them in a number of places on the site, as well as the Bing Geocoding API to get a standardised address. “Given an address, [we can] understand where exactly in the world it is and the geospatial context – how does that map into the real world.” But the new Bing Maps Isochrone API was what they needed to make it practical to show the estimated commute time for jobs across the service rather than just in individual searches, Johnson said.
“Initially, when we were thinking about the problem of, ‘if we had someone’s address and we have the address of a job, how can we tell how far apart they are’, obviously this route calculation exists in Bing Maps already. But we were thinking about how to do this at scale: when you do a job search for recommended jobs we are issuing thousands of queries. At LinkedIn scale, there’s a huge amount of traffic for many, many jobs and it’s just not reasonable to call a [routing] API thousands or millions of times every second.”
Being a little bit more relaxed about the precision they needed helped. “It’s actually OK to be a little bit inaccurate; when someone is considering a commute, if it’s 46 minutes instead of 45 minutes or 44 minutes it doesn’t really matter, because on some days traffic will be lighter or heavier anyway.”
If LinkedIn knows the location for a specific job, it displays a map too. Put in your starting address (whether that’s your home or the nearest bus stop) and choose whether you’re driving, walking or taking public transport to get commute times calculated using Bing Maps predictive traffic. (You can’t currently pick what time you want to leave for work – something that would make a big difference for shift workers – but as the API has a parameter for specifying that, Johnson says it could become a feature if there’s demand for it.)
Soon, you’ll be able to save those commuting preferences (with your address stored as privately and as securely as other details people already trust LinkedIn with, like whether they’re looking for a new job), and that will be used to customise job searches and the roles LinkedIn recommends to members.
Using the Bing Maps Isochrone API was a really good fit for making this scale, Johnson explained. “It changed the problem from ‘I’m a member looking for one job’ to ‘I’m a member looking at all the jobs and trying to understand how do they fit into this context’.” Set how long you’re willing to spend travelling and the search results highlight jobs that are commutable in that time.
The LinkedIn team still had some work to do. What the Isochrone API returns is a multipolygon covering the area reachable in a set time; while it only takes 10 seconds to generate a large isochrone covering, say, a two-hour drive time, the shape created can use a lot of storage space if it has a lot of vertices. “An isochrone is a polygon or a forest of polygons if you choose mass transit,” explains Johnson; “it might be an hour by train then you can get downtown in a short amount of time, so there are multiple polygons that define the isochrone.”
To avoid possible problems with storage and search performance, LinkedIn simplifies those using a Visvalingam-Whyatt algorithm and then counts the number of times a horizontal line drawn across the map from the address point crosses the edges. This is called ray-casting and it’s a clever trick; if the line crosses the edges of the polygon an odd number of times, the point is inside the polygon – if it’s an even number then it’s outside it. That makes it fast to check if a job fits into your travel preferences.
Jobs that fit your ideal commute time will rank higher up the list, and to prioritise jobs with an even shorter commute, LinkedIn uses isochrone ‘gradients’: if your preference is for a 30-minute commute, for example, LinkedIn will also store isochrones for locations within 15 and 10 minutes of travel. “People who are OK with an hour commute would love to have a 15-minute commute, it’s really more ‘what is my maximum’. So, we ideally want to show you jobs that are even closer and rank them higher. In order to do that we generate multiple isochrones; think of it as a bullseye with multiple circles getting smaller and smaller.”
The commute preferences isochrone could also help LinkedIn spot when someone is applying for jobs that are a very long commute away suggesting the travel time isn’t important to them (for example if they’re planning to move to a job in a new area and find a convenient place to live) and should be given less weight in their search results, compared to someone prioritising nearby jobs. “We can use it to further tailor the recommendation experience based on their preferences,” Johnson suggests. That’s the kind of experience that might come to the LinkedIn desktop app and website as well; his team plans to keep expanding where they use the commute time information they calculate with the Bing APIs.
Making all this work relies on having accurate addresses for jobs. When recruiters are posting jobs directly on the site, LinkedIn uses the Bing Maps Autosuggest API to suggest the office address to make it easier for them to add it, and to limit what they can enter to addresses and cities. If they don’t – or if the job comes through a feed that didn’t originate on the site – LinkedIn looks for addresses matching both the employer’s official offices (which they ask company admins to validate) and the postcode in the job ad, and uses the Bing Geocoding API to turn those into more precise locations.
Ranking ads with addresses precise enough to create a commute time should encourage recruiters to start including these details in the future, but inferring addresses makes this useful for existing job listings too. “If we can start to encourage job posters to be posting an address, if we can make that almost an expectation [for a job listing], then we can help job seekers and ultimately posters. Someone with a shorter commute could work more hours or have a better work life balance, will be happier, will be a better employee. This is a win-win opportunity,” Johnson believes.
Find out more about the Bing Maps APIs by contacting the Grey Matter team of mapping specialists: firstname.lastname@example.org or call +44 (0)1364 655133.