Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: howfar.nyc (howfar.nyc)
3 points by ahmedoo 51 days ago | hide | past | favorite | 3 comments
Open standards illuminate different ways of understanding the world. After moving east, I was impressed with how quickly I could get to other major cities in the tri-state area and the breadth of places that people commuted into NYC from. I was also unimpressed with how often my bike was the fastest way to get to other places in Brooklyn. Particularly when apartment hunting, there seemed to be pockets of higher transit accessibility in certain areas that sometimes corresponded to higher rent prices. I needed a map and the past weeks' snow storm was an opportunity to make one.

I pulled some GTFS data and pre-computed transit travel times with Open Trip Planner for every intersection in NYC and some urban hubs in the tri-state area. The transit data includes MTA, CT Transit, Septa, and NJ Transit. The polygons are stored with PostGIS, and leaflet makes quick work of rendering them as GeoJSON layers. I have a few mapping projects on the same stack written in clojure/script so it was a natural extension.

Happy to answer any questions.

Note: Most transit agencies willingly provide their own GTFS data, but Amtrak's had to be FOIA'd so I used a third party cleaned up version of it.



This looks very pretty! I like it and it's very minimalist. This is pretty much entirely outside of my area of expertise, but do you have some library for leaflet that you're using from Clojure? Or just JS interop calls?

It's cool to see sleek projects like this. I made an application that needed to make heatmaps, but I just made a grid of colored squares and cropping some GeoJSON contours and I ended up generating SVGs .. A bit goofy reimplementing a mapping library, but I needed to do some heavy math, so this way it was all JVM code


Using leaflet from Clojure is entirely JS interop calls. You can see an example in my other mapping project here (https://github.com/ahmed-machine/mapbh/blob/master/src/app/p...). I'll add that leaflet 2, while still in alpha, is much nicer to use from CLJS as it replaces all factory methods with constructor calls: (e.g. L.marker(latlng) -> new Marker(latlng)). I've been slowly moving my newer mapping projects over to the new version.

Your project sounds really cool, I'd love to read that code. The implementation in this project largely utilises Leaflet's GeoJSON layers (https://leafletjs.com/examples/geojson/) which does render out to SVGs (there's an optional canvas renderer, too). One of the trickier parts was figuring out how to layer each isochrone band so that those closest to the point (i.e. 15 minute band) were painted on top of the bands further away (https://www.geeksforgeeks.org/dsa/painters-algorithm-in-comp...). That and pre-computing the distances per NYC intersection across the tri-state area which required a lot of messing around with OpenTripPlanner configuration files, GTFS data, and parallelising the code to finish in a reasonable time span (few days).


it's honestly nothing too crazy. I don't have any DB or any API calls or anything.

- The gridded data inputs are all "normalized" to GeoTIFF files (you can using gdal and convert netCDF files easily)

- The Java standard library can handle simple GeoTIFF images with BufferedImage

- I do some math of the BufferedImage data and then plot the results using the thing/geom heatmap plot

- Just heatmaps on their own are kinda confusing. You need another layer so you can visualize "where you are". Here I plot coastlines. (you could also do elevation contours)

- There I have contours/coastlines as GeoJSON polygons. With `factual/geo` you can read them in and crop them to your observed region using `geo.jts/intersection`. You can then convert these to a series of SVG Paths (using `thing/geom` hiccup notation) and overlay it on the heatmap

> and parallelising the code to finish in a reasonable time span (few days)

Oh wow.. so you have a precomputed database!




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

Search: