Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: I built a transit travel time map (henryn.xyz)
255 points by ng-henry on July 24, 2023 | hide | past | favorite | 91 comments
This was something I built while trying to look for housing in Toronto that was decently transit-accessible to my office while still cheap.

The backend is written in Rust. It parses public GTFS data from transit agencies and performs a simple heuristics-based BFS on the bus lines to calculate how long to reach all points in a city.

The frontend uses React and Mapbox GL to render each individual road segment based on how long it takes to reach.

This project was a great excuse to learn Rust, deployments, and mapping. The source code is here if you are interested: http://github.com/econaxis/time2reach




Public service announcement - these kind of maps are known as isochrone maps and they're anything but new, but are (IMHO criminally) unpopular. They're extremely helpful when house hunting.

https://en.wikipedia.org/wiki/Isochrone_map


Agreed. It took weeks of researching to find this term when I was looking to optimize travel time search. Once I did, everything became easier! Ended up forking Open Transit Planner, this was back in 2015. Turned 40 minutes real estate searches into 40ms or so.


Wouldn't have helped you back then but LLMs are _spectacular_ at giving you the term that you don't really know what to google for.


Agree. I tried this with figuring out the name of a logical fallacy. And it led to a rabbit hole of info.


What is this Open Transit Planner and where do I find it?


I believe they're talking about http://www.opentripplanner.org/.


Is your fork available somewhere cause it sounds awesome!


They are to a point, I think.

I made one of these in the past when looking for places to live in London. The ultimate conclusion was that you could have inexpensive, short travel time, or nice/safe, choose two.

I gave up after realising that the market signals worked - if ignoring Central London it'd pretty much just be "more expensive = nicer"


They are also popular when establishing an office space, or when recruiting en masse for job opportunities/


Yeah I would have noticed that the place I’m renting for a month in Montreal is in dark shades of blue!


The following site works for The Netherlands (not just Amsterdam): https://mapitout.iamsterdam.com/

It has some minor limitations to select the time (has to one of the predefined options). That can be worked around by changing the URL parameter.

It can also map out multiple locations and see the overlap.

It's fairly useful to see where you want to live while taking e.g. the office location into account. It gave me more options than I thought I had, partly because I didn't think about small towns with a train station.


Wow, this website is very pretty. It's similar to what I envisioned when I built this project, but I wanted to make a heatmap (of all possible times) rather than just an isochrone. The little "islands" of fast transit access is also what I wanted to show with my project too! It's cool to discover the little spots near train stations that are cheaper but offer an equivalent commute to the city center.

There's also https://www.chronotrains.com which was another inspiration when building this project too.


Hey, that's super interesting. Put in my and my SO's current distances, and the overlap seems pretty accurate (though smaller than I was hoping for!)


This is super cool! I particularly like that you render the route along transit lines to reach each destination, which is differentiated from other isochrone maps I've seen. I would love to use this while hunting for apartments in a large city.

I do think there are a number of things you could do to improve the UX here. Hope this doesn't come across as too harsh, but here are some suggestions...

1. Double-click to set origin makes sense, but hover to set a destination is a bit weird, for two reasons: a. There's no way to "lock" a destination by clicking, so I can't pick a route I want to see and fix my view on it. The UI feels jittery as a result. b. In some cases (I'm looking at NYC), loading the route to the hovered destination hangs for several seconds. I don't know if this is just an issue because your server is overloaded, but it's a weird state to be in.

I'd consider: 1) adding a loading state when the route to the destination is being computed, 2) enable clicking a point to lock viewing that route, 3) maybe disabling the hover interaction entirely, though if it were performant, it would be pretty nice to have.

2. The "arrival time" concept is a slightly odd. I'd prefer to just see the amount of time it'll take to get to a destination, rather than an arrival time based on a particular starting time. I don't think anyone's going to use this to plan a specific route at a specific time; instead, they'll use it to explore locations of interest, and explore how long it'll take to get to various destinations. I see you show the trip duration in the bottom-left, but having it be an arrow pointing to a gradient spectrum is much harder to parse than just saying "27 minutes".

3. The fade effect on the side panel is a bit weird. It does draw more attention to the map, but the side panel is still occluding my view, and having it faded just makes the text very hard to read. I'd consider making it un-faded, but adding some way to collapse it.


Hey, thanks for the feedback! Greatly appreciated.

1. Yes I think "locking" makes sense. The entire action of viewing the paths to different destinations still needs to be polished up, especially for the mobile version as well. When I tried it before posting to HN it was instant (30ms) but now it seems to be extra laggy because the CPU is maxed. I just upgraded the server from 4 -> 16 cpus, so let's hope that does something haha.

2. 100%

3. Agree as well. I chose the easiest solution when developing (and I also develop on a large monitor so it's harder to notice the occlusion), but adding a hide toggle would certainly have been better.


>2. The "arrival time" concept is a slightly odd.

There's nothing odd about it. Your arrival time entirely depends on the train schedule, and you can only arrive at your destination at certain discrete times because of this.

>I don't think anyone's going to use this to plan a specific route at a specific time;

I use Google Maps to do this exact thing all the time. I need to be at a certain place at a certain time, so I set the place and arrival time and have it plot a route and show me all the available options.


Arrival time makes perfect sense when the objective is getting to work. If I need to be at work at 8am the (hypothetical) bus that gets me there at 7:50 works but the one that gets me there at 8:05 doesn't. Simply looking at travel time doesn't tell me I need to sit an extra 10 minutes.


I get sad every time I return back to America from Asia because of how small the public infrastructure is in many parts of America compared to Asia.

If anyone has lived or at least visited places like Tokyo, Japan or Shanghai, China, you probably understand what I am referring to.


I have maintained that any US Public Transportation employee with any amount of agency/authority should be required to go to SEA (singapore, HK, Shanghai, Tokyo) and be required to go to meetings which are far from their hotel but they must get there via public transport only...

This will make their requests for more money/raises/etc seem absolutely insane when you compare what these countries/cities/agencies do WRT to transporting millions of people efficiently every single day - and not to mention just how clean such systems are.

When you go through stations in HK - you see well-uniformed cleaning folks all over the place.


HK has an interesting business model in that the MTR is majority owned by the government and the government grants the land on top of train stations to MTR. MTR then generally builds shopping malls, offices and residential developments e.g LOHAS park, there making it a property company which operates (very profitable) rails between its properties. Hence, the average person not only travels on the MTR but also spends money at MTR Malls and may live and/or work in an MTR property. MTR corporation also provides consultancy services and even runs other railways in other countries e.g the Elizabeth Line on the London Underground.


Population density makes a huge difference. The more people live in a city, the more funds the government has to invest to get a better transportation system.

In general, population density in East Asia is far higher than in the US.


This is a chicken and egg problem, stop making excuses for Western governments. Nearly all US cities had streetcars and dense walkable downtowns. There are pictures of this. They were destroyed in the 1950s due to pressure from car/oil lobbies, as well as eager house buyers who wanted cheap FHA loans. (Only available to whites)

Europe is not immune either, they would've followed the US's footsteps entirely if it weren't for the 1973 oil shock, which hit them harder than the US.


I know you didn't name a city, but since everyone says this about Los Angeles due to Roger Rabbit, I'll zoom in on LA. The LA street cars, Pacific Electric and LA Railways, were operated by Henry Huntington to sell real estate and were increasingly unprofitable over time. This definitely wasn't helped by increasing competition from private automobiles, the 1910-20s version of rideshare called "jitneys", and local buses, but the streetcars weren't there as a charitable public service and rarely reinvested in itself. In 1925-1926, they proposed having LA city fund expansion and rapid transit, but the public and press at the time were very against elevated lines and increased taxes. There was no shortage of racism (as evidenced by voters destroying half of Chinatown to build Union Station), and LA Times infamously called elevated lines "four miles of hideous, clattering, dusty, dirty, dangerous, street-darkening overhead trestles." That basically sealed the streetcars' fate, and what the car industry did decades later was picking apart their corpses.

I'm sure that Roger Rabbit might be more true for some cities, but I dislike that LA and other cities cling on to this. It excessively absolves everyone else -- politicians, press, homeowners, and PE/LARy themselves -- of their own fault. They could've saved their transit system like London did in the 1920-30s. Even today every SFR owner seems to prefer pointing at the Roger Rabbit story rather than looking in the mirror. Thank god for AB2097 and other new laws that address low density.

Sources -- basically any source that's not Roger Rabbit will tell you the same thing:

* http://scsra.org/library/rapid-transit-history/

* https://laist.com/news/entertainment/union-station-history

* https://www.vox.com/2015/5/7/8562007/streetcar-history-demis...

* This entire book; the preview pages have a lot of pertinent parts: https://books.google.com/books?id=OfTlph3cXoQC


> They were destroyed in the 1950s due to pressure from car/oil lobbies

Popular explanation but largely false. They were destroyed because people quit using them.


Why and how did people quit using them? Suppose you're in a world where the interstate highway system hasn't been built and subway trains are the dominant mode of transportation, and you would like to stop taking trains to get to places, what do you do? Walk? Bike? Ride a horse? Drive offroad in a car with a manual transmission and no seatbelts or airbags, with no gas stations in between?

Seems like you'd be S.O.L. unless the government kindly free-markets a continent-wide network of paved roads, with conveniently placed roadside stops along the way where they sell gasoline. Can't imagine why they would undertake such an exorbitant public works project when the transcontinental railroad already exists; it's not like the government is disproportionately influenced by any industries that would very obviously materially benefit from such a thing.


People use e-mail more than snail mail nowadays too. Funny, that.



But it's far more satisfying to blame some change you don't like on $EVILCORP than a more complicated narrative that revolves around people as a whole preferred something different so it didn't really make sense for government/a company to keep pouring money into a pit to keep a small minority happy.

The story often goes that someone destroyed a fully operational system for profits when in fact the system was badly deteriorated and not really used a lot.


Do you REALLY think gasoline subsidies and government backed 97% LTV mortgages is a free market? People were coaxed out of cities with very generous subsidies as well as race baiting (redlining)


People moved out to the suburbs for a lot of reasons--not least of which was the post-war baby boom. The US government certainly didn't discourage it (though they were arguably pursuing policies the majority of the population wanted) and the exodus added fire to a self-reinforcing cycle of urban problems (including race-related ones)which lasted at least through the 1980s. And arguably we could see movement out of at least some cities again.

I'm not especially pro-suburbia--I live in an exurban/almost rural location. But I think it's perfectly understandable why many people wouldn't live in a city given a choice which they increasing had post-WWII in the US.


There’s not much correlation between density and quality of public transit.

If you look at a top 10 list of best transit systems, you’ll see medium density cities like Oslo and Helsinki right beside Tokyo and Hong Kong.

Or within the USA, compare Miami to Seattle. The only difference is that one city decided to build mass transit and the other didn’t.

It’s entirely possible to build an appropriate transit system for any type of city.


Past a certain density point probably. It also helps if there's some degree of concentration where people want to go even if the city as a whole is only medium density.

However, things get too spread out and it breaks down--including that transit runs on a sufficiently spaced-out schedule that people with a choice just don't want to take it.


I was just in Paris. It was a major eye-opener for me to observe people on the Métro when there was a train approaching while I was a little ways away from the platform. Very few people rushed to make it! It initially made me doubt that I understood how the train worked—did they know something I didn't, and this train wouldn't actually stop where I needed? But no, it was just that they knew that if they missed the train, they would only need to wait a whole 3 minutes for the next one.

Coming from the SF Bay Area, if you miss a train you'll probably have a minimum 15 minute wait (at least at the stations and times I use), often 2-3x more. People run down the stairs to the platform, shove their way in, and often block the doors from closing if they're squeezing in at the last minute (which extends the last minute, making the train later for the next stop.)

Also, "taking the train" doesn't just mean showing up at the train station. It means checking the schedule and timing it so you show up at the right time. I don't just walk from place to place, using the train as a way of getting around as needed. I plan it out. Or I don't, and use a car instead, which everything subtly encourages.

I agree, frequency makes a huge difference in actual practice.


For all its recent problems, the Boston subway isn't too bad. I certainly don't check schedules.

But the commuter rail out to me only runs about once an hour. I can deal with that for a "9 to 5" work thing where driving would have to deal with horrific traffic anyway. But it's a total non-starter for an evening event where I would have to time my return including possibly dealing with subway variance to a commuter rail station. (And it takes significantly longer than driving at that time of day anyway.)


And frequency is related to density.

The denser the population the better mass transit works and the more burden having one's own car produces.


Last time I went to Japan, they had announcements of apologies about severe delays. The delay was less than 5 minutes.

Today I'm stuck on a tram for an hour and the tram company did not even tell us what happened or when would we be unstuck.


Asia is also home to cities with some of the most congested sprawl with mediocre (at best) public transportation in the world. Tokyo and Shanghai are great. Somewhere like Jakarta less so.


I hope you are not comparing American suburbs to Asian urban communities. This is a common misconception among immigrants that they compare commuting opportunities of suburbia to urban cities in Asia.


Does "double click anywhere" mean "double click anywhere within these N cities"? I couldn't initially tell if they were examples or limits.


limits, the gtfs data is only set for those cities / transit providers


It’s only the five cities listed at the top, right?

(I initially thought they were just bookmarks/shortcuts to some good demos then I realized they influenced the traffic sources checkbox at the bottom so they had to determine what the map showed rather than merely index it.)


Yes that's right. I do plan on adding other cities in the future, but these are the ones I've chosen because I've lived in them or I think they have a cool transit story.


Cool - and I can’t argue with the rationale! Here’s a vote for Chicago: it’s considered to have one of the best public transportation systems in the USA and it’s rather different from the east coast models. Might be fun!


I want very similar to this but for shopping without a car.

Like, if I want to buy something big from Walmart or Costco (to keep to generic shop names) and it does not matter if I am on a train/metro/subway for 10 minutes or 20 minutes, but it totally does matter number of transport switches of bus->subway) and walking is really bad.

So, it would make sense to go to a very distant shop, but that is right opposite the direct train.

Does anything like this exist (for any city really)? The algorithm must be quite similar, but with different graph steps weighted differently depending on method of movement.


Not sure if something like this exists yet, but certainly do-able within my implementation.

For example, when choosing the best route, it penalizes every transfer by 120 seconds [1]. Therefore, a route that takes 2 minutes longer is equivalent to one transfer.

It'd be cool to have a tool where you can dynamically change these settings, and maybe even have different transfer penalties depending on if you're transferring inside a station vs walking outside.

[1]: https://github.com/econaxis/time2reach/blob/main/src/formatt...


This is a great idea. I can only speak to NYC, but the data sources don't give good recommendations. Optimal routing for time in NYC is tricky though and relying on only mapping services and not a combination of walking, biking, buses, and subways leads to longer travel times than necessary.

For example, there are many parts of Brooklyn where no transit lines are directly connected and you have to go into Manhattan first, meaning if you took the train it would take 1+ hours, versus bus (30 minutes) or biking (15 minutes).


Have you used CityMapper? I haven't used it in NYC, but I use in in London, and it's solved this problem much better than Google/Apple Maps.

Edit: Though, CityMapper doesn't actually provide a travel time map, alas.


Experienced this problem too in Toronto, when Google Maps wouldn't give transit + bike directions (which are often much faster than transit + walk). As you know the city more though these things become intuitive and Google Maps becomes less useful.

I started using Transit App more often for the mixed-modes routing. It even supports bike shares/scooters, so sometimes it suggests new routes based on scooter -> subway -> scooter which is much faster than bus -> subway -> bus.


This is awesome - https://www.mapnificent.net/ is a similar project (also open source). Might be cool to collaborate on data sources?


Very nice! Do you have any documentation for how to add another city or transit region?

I work on some of the rust libraries you've used. If you'd like to ask questions about rust+geo or do a show & tell, consider joining us in the georust discord: https://discord.com/invite/Fp2aape

I'm also always interested to hear new people's experience building real things with our libraries. What were the hangups?


What a cool idea! Sadly, the Mapbox vector maps really struggle on my mid/low range Android phone (Firefox as the browser).

I've actually briefly looked into it before, but I've no idea why vector maps in particular are so bad, yet everyone still praises them a lot vs regular tiled raster maps: https://www.youtube.com/watch?v=A-IRtBGO9rM

Not to detract from the cool thing you've made, don't mind my musings.


Nice! Once upon a time I did something very similar.

https://www.forrestthewoods.com/blog/visualizing_commute_tim...

AFAICT the only reliable source of commute and transit times is Google Maps. To be useful it requires real traffic data. Unfortunately Google jacked up the prices way too high to be useful.

My dream is a service for building isochrone maps with full support for walking/biking/transit/driving.


I used the walkshed map (also supports bike, car, and transit) to decide which part of the city to live in.

https://app.traveltime.com/search/0-lat=43.64399&0-lng=-79.3...


Google doesn't generate traffic data for public transit services; they buy it from the agencies that run those services. You can go directly to them for it.


This is amazing. I'd love if it could include:

1. Percent cancellations of lines (past 30d, past 1 year)

2. Average & deviation of delay (past 30d, past 1 year)

I think these factors could be used to identify unreliable lines. For example, looking at my commute line, it seems like I could get into the city in 50ish minutes but I know most of the times I get on the train from door to door it has been recently very unreliable with the most recent times being ~1hr min door to door.

We also have a lot of problems with cancellations on my way home.


Love it, but I’m pretty sure you’re missing ferry routes in the NYC calculations (which are public). It also might be worth including Citibike as an optional additional method.


This is super super cool! This kind of visualization is so much more useful for finding a transit-friendly spot to live than the generic TransitScores real-estate websites have. Would be nice if the frequency of bus routes could be visualized too, and hope you find a way to add more cities painlessly. Having worked in transit planning, this is really useful for network gap analysis - like finding areas where connectivity could be improved.


Super awesome! I like how you just color roads to show time. When you calculate polygons to try and cover the whole area in some 5-10 minute bucket, you can wind up with all sorts of odd holes far away from roads. Keep it simple.

https://github.com/a-b-street/abstreet/pull/1075


SF Bay Area map is somewhat lacking of about half the BART system (SF to Antioch by BART is less than 90mn, but doesn't show at all. Same for Dublin). Also everything North and East of Berkley is cut off, and most of San Jose is missing. As is everything in the North Bay. SMART, County Connection, Marin Transit, SOLTrans are all listed by no data shows up.


I open it on mobile and got an entirely white page


Oops! I was only able to test it on my iphone and the devices in the Chrome browser simulator :(. If you're willing, what phone/browser are you using?


i had the same in FF desktop , blank page with JS enabled (ublock default = disable everything)

Then i enabled all Font and Cosmetic Filtering to ON on uBlock, and the website worked.

One of the few sites that requires Cosmetics / Fonts enabled to work right.


Pull up San Fransisco, double-click on the Sunset, get depressed at how little distance you can cover in 45 minutes.


I believe the author is missing some data sources (bus lines?). There are areas I know are reachable within 30 minutes from downtown Berkeley that do not appear on the map.


I used to visit San Francisco and the Bay Area a lot for work. I could be wrong, but it feels like capping the travel time at 45 minutes is too low. A lot of people down there seem to have commute times more like 1-3 hours each way. I assume the low cap is also why the map also doesn't include the Caltrain heavy rail line that connects San Francisco to cities as far south as Gilroy.


You can adjust the time where it says "Maximum trip duration".


I really like your map styling! It's slow but nice when working.

People interested in this might also enjoy: https://www.mapnificent.net/

Or if you're in Ireland: gaffologist.com (disclaimer - I made this and it only focuses on rail)


Is there a word/map for the transit accessibility for each point (1m^2?) on the map and drawing that? (maybe an integral of the isochrone?)

E.g. pick a point on a map, sum the area of the isochrone (30minute area? weighted sum?) to get a value at that point. Then redraw a heatmap of those points.


The idea is very nice, useful for example when looking for a flat that isn't too far away from work. However it doesn't really work. My computer is powerful, and yet it lags so badly I can't really get to use it. I also did not manage to change the starting point.


This is great! I actually needed something like this right now. I’m looking for a new job and a lot of the posts available are in-office, so being able to set some boundaries on commute time is exactly what I need to do. Thanks for including mtl!


Lovely!

An more general alternative (different travel modes and all the cities I think, possibly less accurate, no lovely heat-map style): https://app.traveltime.com


Great job. I feel like I have seen other iterations of this for NYC with much limited data.

Input: NYC is missing PATH train transit system. It might also be missing Port Authority Bus Terminal transportation methods.


Reminds of me a site I used when house hunting:https://www.mapnificent.net/


Beautiful. I did something similar recently with the Google Maps Distance Matrix API, but I like that this doesn't require an external API for every calculation.


I seems to be slowing down quite a bit after I double clicked, or maybe HN visitors coming in. Is this implemented with a Graph database?


This is awesome! I'd love to be able to bookmark this with a specific starting location set in the URL.


I'd love to be able to get a print of the map with a customized zoom level and origin point.


THIS IS VERY COOL! do you have more cities that you plan on adding in the near future?


Nice job with the map! It was great seeing your presentation at symposium!


Great work! Would it be complex to add plain walking, or cycling options?


Tried some EU countries but did not work. What country is supported?


Yep the only cities that are supported are on the list at the top: Toronto, Montreal, Vancouver, New York, and Paris.

Adding support for other cities is a pain in the butt to find the corresponding GTFS, upload the vector tiles to postgis, etc.


I just zoomed out from Toronto and tried Waterloo/Kitchener and it worked... [edit] but apparently I was just lucky.


Hahaha you discovered it! Originally I had waterloo because I study there, but I removed the city from the picker as I thought HN wouldn't know what Waterloo was :).

It even supports GO buses between Waterloo <-> GTA (unfortunately the max is 3 hours so you can't get everywhere just yet).


Works with Paris at least


Seems like it is missing PATH (NJ <-> NYC)


Not working in all countries? Nice work, though.


Beautiful UI. Is there any practical use for it?


~~getting job interviews~~

haha just kidding...I'm unsure of whether this is useful at all to transit companies, but one goal of this project is to make transit cool and help people understand their cities better.

I originally built this to help me find housing in Toronto, so deciding where to live could be another good use of this tool :)


page is totally blank for me, on firefox if thats relevant


According to another comment, someone tried disabling Font and Cosmetic Filtering on uBlock and it worked for them?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: