Getting Full List of Zones With Geometry #614
Replies: 1 comment 2 replies
-
This is what has worked for me before after a lot of trial and error. Unfortunately I'm also now seeing some 500 errors as I'll detail below. First, I do calls of the form: https://api.weather.gov/zones?include_geometry=false&type={type} where {type} is from the list "land", "marine", "forecast", "public", "coastal", "offshore", "fire", "county". I cache all of the codes I retrieve. The include_geometry parameter is key to minimize the amount of data returned. Then I individually fetch each code's information ( https://api.weather.gov/zones/{type}/{code} ) to get the geometry. I'm currently seeing 500 errors returned for the first call for the following types: land, forecast, fire. |
Beta Was this translation helpful? Give feedback.
-
Hi, I've been having a hard time building out a list of all zone geometries (fire, county, marine, public, etc) in my local database. What I've attempted to do is get the list of each type of zone from endpoints like: https://api.weather.gov/zones/public then loop through each zone, and call the detailed version to pull down the geometry.
This has worked well for some but I get 500 errors for some types such as this when trying to get all public zones:
{ "correlationId": "27abac0", "title": "Unexpected Problem", "type": "https://api.weather.gov/problems/UnexpectedProblem", "status": 500, "detail": "An unexpected problem has occurred.", "instance": "https://api.weather.gov/requests/27abac0" }
I read on the known issues page that requesting all the zones can result in a 500 as it's a ton of data and you should use the limit param. That helps as I can get 100 records back just fine but I don't see any paging options to get the next 100 records.
Is there a better way to get a list of all the current zones that I can then loop through and call the details for? (i.e. https://api.weather.gov/zones/forecast/AMZ131)
I found all the shapefiles and spent several days converting those to geojson but that process didn't seem to work for me as I got a bunch of invalid data from that. I'd also prefer to have scripts to pull from the API in order to facilitate updating the data in the future more easily.
Any help or suggestions would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions