focusconsulting / housing-insights

Bringing open data to affordable housing decision makers in Washington DC. A D3/Javascript based website to visualize data related to affordable housing in Washington DC. Data processing with Python.
http://housinginsights.org
MIT License
58 stars 110 forks source link

Calculate metro and bus route distances #73

Closed NealHumphrey closed 7 years ago

NealHumphrey commented 7 years ago

Using Mapbox's Python SDK, calculate the number of (a) metro stops and (b) bus routes within 0.5 miles walking distance of each building in the project table from our database.

salomoneb commented 7 years ago

Very quickly grabbed the location data for Metro stations and bus stops

JSON files: transport_data.zip

NealHumphrey commented 7 years ago

Cool @salomoneb !

@prisalex came to the Code for DC hacknight and joined up on the project; she started looking into this then (but I'm guessing w/ amount of time available probably didn't get very far). We can coordinate on this tomorrow and see what help she needs.

prisalex commented 7 years ago

Hello there, was actually planning on working on this today. I'll keep you all posted on progress...

salomoneb commented 7 years ago

Cool. If you didn't already see it, Mapbox's Distance API looks like it might be good for this.

prisalex commented 7 years ago

@NealHumphrey This is the output csv for just one of the proj locations. Let me know if this format matches what you want. I wasn't sure if you wanted the bus lines themselves in the CSV. In which case I can just concat them all in one cell or can split those out into individual lines.

Also, I did try to use the Python SDK but had some problems using it so looked at the Mapbox API docs and they claim that the distance API isn't supported in the Python SDK. See here. So I went with the REST API, which had better docs anyway. Let me know if that is an issue.

I'll create a PR for my code once you approve the final CSV format...

NealHumphrey commented 7 years ago

Great @prisalex !

We do want the bus line(s) at each stop. Ultimately the most robust version we might want to display is:

To get this into SQL, the simplest normalized way is probably two tables:

REST API is all good, whatever works!