Find your nearest cup of coffee with Turf

Mapbox
maps for developers
1 min readJan 14, 2015

By Peter Liu

Turf has opened a wide range of possibilities for apps running entirely in the browser. In this example, we’ve built a store locator that finds all Starbucks locations near a user’s current position. Drag the little green figure to move it around and mousewheel up and down to adjust the search radius:

Trouble with the map? Try the direct link

Under the hood Turf is:

  • Finding all locations around the user out to the desired search radius
  • Measuring the distance to each location
  • Identifying the closest location to the user

Best of all, Turf is crunching this math on a set of 19,979 locations worldwide on the fly, right in your browser. Simple experiments like this are getting us excited about Turf’s potential for giving anyone with a modern internet browser a powerful suite of tools for geospatial analysis.

The term “Starbucks” is a trademark of Starbucks Corp. This website is not affiliated with Starbucks Corp.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Written by Mapbox

mapping tools for developers + precise location data to change the way we explore the world

Responses (2)

Write a response

Hello friend, first of all I want to tell you that I admire your work. Just for my work I need to develop something similar, which is why I love this example, however, since this week I can no longer see the buffer or the cafes or my location. Will…

Thanks for this example. I need source for this particular example. Can please provide the download link for this example?