insightindustry / walkscore-api

(Unofficial) Python bindings for the WalkScore API
http://walkscore-api.readthedocs.org
MIT License
1 stars 1 forks source link

problems getting transit scores #3

Open isamartroncoso opened 4 years ago

isamartroncoso commented 4 years ago

Hello, I am collecting walk, bike, and transit scores using this library (thanks for developing it!), but I am having problems with the transit scores. I am getting null values in all the cases I tried, but I verified on the website that those values exist (search for many examples). Do you have any idea why this is happening or suggestions about how to fix it?

insightindustry commented 4 years ago

@isamartroncoso Can you share an example of a location where you're attempting to get a transit score and you're receiving null values? When I attempt to get transit scores, it seems to be passing tests so I'm trying to recreate the issue. If you'd rather not share it publicly, you can DM me on twitter (@InsightIndustry).

isamartroncoso commented 4 years ago

Thanks for the reply. Here is an example of the

result = walkscore_api.get_score(latitude = lat, longitude = long, address = address) result = result.to_dict() print(result) {'status': 1, 'walk': {'score': 45, 'description': 'Car-Dependent', 'updated': datetime.datetime(2019, 10, 30, 1, 6, 12, 89068)}, 'transit': {'score': None, 'description': None, 'summary': None}, 'bike': {'score': 37, 'description': 'Somewhat Bikeable'}, 'original_coordinates': {'longitude': -95.202753, 'latitude': 29.923341, 'address': '12230 W Lake Houston Pkwy, Houston, TX 77044'}, 'snapped_coordinates': {'longitude': -95.2035, 'latitude': 29.9235}, 'logo_url': 'https://cdn.walk.sc/images/api-logo.png', 'more_info_icon': 'https://cdn.walk.sc/images/api-more-info.gif', 'more_info_link': 'https://www.redfin.com/how-walk-score-works', 'help_link': 'https://www.redfin.com/how-walk-score-works', 'property_page_link': 'https://www.walkscore.com/score/12230-W-Lake-Houston-Pkwy-Houston-TX-77044/lat=29.923341/lng=-95.202753/?utm_source=isamartroncoso.com&utm_medium=ws_api&utm_campaign=ws_api'}

First I contacted them because I thought the was a problem with my API key, but they said they add me to the Transit Score query too :/

isamartroncoso commented 4 years ago

Maybe that was a bad example because it turned to be 0 in the transit score. But here is another one:

lat = 29.52829 long = -98.560399 address = "9502 Interstate 10, San Antonio, Texas, 78230"

result = walkscore_api.get_score(latitude = lat, longitude = long, address = address) result = result.to_dict()

{'status': 1, 'walk': {'score': 72, 'description': 'Very Walkable', 'updated': datetime.datetime(2019, 11, 12, 1, 15, 48, 658256)}, 'transit': {'score': None, 'description': None, 'summary': None}, 'bike': {'score': 51, 'description': 'Bikeable'}, 'original_coordinates': {'longitude': -98.560399, 'latitude': 29.52829, 'address': '9502 Interstate 10, San Antonio, Texas, 78230'}, 'snapped_coordinates': {'longitude': -98.5605, 'latitude': 29.529}, 'logo_url': 'https://cdn.walk.sc/images/api-logo.png', 'more_info_icon': 'https://cdn.walk.sc/images/api-more-info.gif', 'more_info_link': 'https://www.redfin.com/how-walk-score-works', 'help_link': 'https://www.redfin.com/how-walk-score-works', 'property_page_link': 'https://www.walkscore.com/score/9502-Interstate-10-San-Antonio-Texas-78230/lat=29.52829/lng=-98.560399/?utm_source=isamartroncoso.com&utm_medium=ws_api&utm_campaign=ws_api'}

insightindustry commented 4 years ago

So for the first address, the issue is definitely on the WalkScore API side. When you try using the following link directly:

http://api.walkscore.com/score?format=json&address=12230%20W%20Lake%20Houston%20Pkwy,%20Houston,%20TX%2077044&lat=29.923341&lon=-95.202753&transit=1&bike=1&wsapikey= YOUR API KEY HERE

(note that you need to replace YOUR API KEY HERE with your API key)

the result returned clearly does not contain a transit score (despite transit=1 being set):

{
"status": 1  
, "walkscore": 45
, "description": "Car-Dependent"
, "updated": "2019-10-30 01:06:12.089068" 
, "logo_url": "https://cdn.walk.sc/images/api-logo.png"
, "more_info_icon": "https://cdn.walk.sc/images/api-more-info.gif"
, "more_info_link": "https://www.redfin.com/how-walk-score-works"
, "ws_link": "https://www.walkscore.com/score/12230-W-Lake-Houston-Pkwy-Houston-TX-77044/lat=29.923341/lng=-95.202753/?utm_source=insightindustry.com&utm_medium=ws_api&utm_campaign=ws_api"
, "help_link": "https://www.redfin.com/how-walk-score-works"
, "snapped_lat": 29.9235
, "snapped_lon": -95.2035 

, "bike" : {"score": 37, "description": "Somewhat Bikeable"} 
}

So that's an issue on the WalkScore API side, I'm afraid.

insightindustry commented 4 years ago

Further, when you go to the property page (see the property page link in the response above), it also gives a Transit Score of 0 (Minimal Transit). This suggests that the API is returning transit scores of 0 as identical to null values. Personally, I'd view this as a design flaw in the WalkScore API (null and 0 actually mean different things, logically), but it's the way their API is designed.

insightindustry commented 4 years ago

As for the second address you supplied, that seems to be returning the correct transit score (value of 31) from the API, so all looks to be good there.

JackShipway commented 2 years ago

Hey there,

Thanks for making this library!

I was hoping you could help me out, as I seem to be running into the same problem. The difference though is I have a dataset with about 300 observations, and the returned transit scores for all of them are null. I personally know a few of these locations, and there are bus routes right next to them.

The API doesn't return scores of 0 as equal to null for all scores, as I have recorded scores of 0 for walking.

Here are a few addresses which return transit scores on the walkscore website (shown values are from the website), but that return null values for transit score through the library/api:

30553 Great Northern Avenue, Abbotsford, Canada (ws 25, ts 30, bs 44) 2220 Dollarton Highway, North Vancouver, Canada (ws 50, ts 46, bs 77) 845 Tupper Avenue, Coquitlam, Canada (ws 51, ts 75, bs 63)

I'm quite confused, and would like to try and fix my dataset if possible! Thanks in advance for any help.

insightindustry commented 2 years ago

@JackShipway No worries - let me look into this and do a little digging. See if I can determine what might be causing the issue.

JackShipway commented 2 years ago

So for me it was an API key issue, turns out they have to specifically add you to the transit part despite having a Walkscore API key, which I believe I read was supposed to be good for all three scores.

Not sure if I misread something, or if the Walkscore API documentation was just misleading...

Regardless, if anyone else comes across this issue, double check that you have received a Walkscore API key, and then have reached out separately to the Walkscore team to get that same original key added for Transit data too.

carlhorwitz commented 1 year ago

Hi all, thanks for making this. Such a great resource. I'm also having an issue getting the transit score... would love some assistance with that.

walkscore_api = WalkScoreAPI(api_key = api_key) result = walkscore_api.get_score(latitude = 39.69551, longitude = -104.92489)

returns a walk and bike score but not transit (I tried it first with the return_transit_score=True as well... didn't make a difference)

Thank you!

insightindustry commented 1 year ago

@carlhorwitz Thanks - did you verify that you have access to the Transit scores via their API? As Jack mentioned above that can cause an issue if the WalkScore team has not granted access to Transit Scores on your account / API key.

If you’ve confirmed that you do have access, I’ll do some digging and see if I can find what the issue might be.