Uncategorized
Brooklyn

Why this bike race map is also measuring your computer screen

Racefinder.bike is a simple map based on a clever solution.

(Image via racefinder.bike)

Web engineer Jayson Jacobs has built a tool for finding out which bike races are happening near you in the U.S. and U.K. (He hopes to add other countries soon.)

Racefinder.bike is a basic map and calendar utility that lets you search near a zip code over a period of time. It also measures how big your screen is and how much map you are displaying on it from moment to moment.

Find a bike race near you

Jacobs wanted a way to view races as markers on a map. No one had done that, but once he built it he found it was causing problems that made some mobile browsers crash.

He realized the cause was memory leaks in Google Maps, which he needed to limit. He decided that the best solution was to display no more races than the screen could actually show at that moment. Here’s how he described his solution in an email to Technical.ly Brooklyn:

Using a formula first derived in the early 19th century to calculate distances between two latitude and longitude points, the Haversine formula (haversed sine, or versed sine – from the Latin sinus versus or “flipped sine”), I got the latitude and longitude of the corners of the map, calculated the distance between those points and using geospatial queries native to Mongoose, returned only the points within the bounds of the map being displayed. I then clustered the makers by determining the size of the marker, in pixels, and based on the zoom of the map (distance in miles between the corners, not the actual, arbitrary, zoom number) calculated how many miles a marker covered, then grouped all markers within that distance under one, larger, marker.

Jacobs is a web engineer at Huge and a competitive cyclist. He’s also serving as the president of the Century Road Club Association. He hopes to add more races and countries to the list, but there’s no standardized format for sharing the info, so it involves a lot of scraping data and cleaning. He hopes to get a lot of updates done before cyclocross season starts.

Companies: Huge

Before you go...

Please consider supporting Technical.ly to keep our independent journalism strong. Unlike most business-focused media outlets, we don’t have a paywall. Instead, we count on your personal and organizational support.

Our services Preferred partners The journalism fund
Engagement

Join our growing Slack community

Join 5,000 tech professionals and entrepreneurs in our community Slack today!

Trending
Technically Media