waldoj / frostline

A dataset, API, and parser for USDA plant hardiness zones.
https://phzmapi.org/
MIT License
146 stars 25 forks source link

Any way of capturing higher resolution data? #5

Closed webmaven closed 8 years ago

webmaven commented 8 years ago

AFAIK, the Zipcode query will return the zone at the center (centroid?) of the Zipcode area. For Zipcodes that cover areas with steep slopes (or have other features that create microclimate variations), this ends up not being very useful.

Is there any way to query for specific lat/long coordinates instead, and construct a higher resolution dataset?

waldoj commented 8 years ago

Not that I know about. The USDA's web query system only permits queries by ZIP, and that's the API that's being used to extract this data.

webmaven commented 8 years ago

I've been digging in to see if I could find a workaround, but:

Which makes calls like these: http://planthardiness.ars.usda.gov/ArcGIS/rest/services/uspz/MapServer/identify?f=json&geometry=%7B%22x%22%3A-11853548.442455426%2C%22y%22%3A4167059.8761059865%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&tolerance=3&returnGeometry=true&mapExtent=%7B%22xmin%22%3A-11869218.033253865%2C%22ymin%22%3A4141606.3456870574%2C%22xmax%22%3A-11798437.345061889%2C%22ymax%22%3A4187927.1848278116%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&imageDisplay=400%2C400%2C96&geometryType=esriGeometryPoint&sr=102100&layers=all%3A0&callback=dojo.io.script.jsonp_dojoIoScript13._jsonpCallback

So, after some URL simplification, what do you make of this URL?: http://planthardiness.ars.usda.gov/ArcGIS/rest/services/uspz/MapServer/identify?f=json&geometry=%7B%22x%22%3A-11853548.4424554%2C%22y%22%3A4167059.87610599%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&tolerance=3&returnGeometry=true&mapExtent=%7B%22xmin%22%3A0%2C%22ymin%22%3A0%2C%22xmax%22%3A0%2C%22ymax%22%3A0%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&imageDisplay=1%2C1%2C1&geometryType=esriGeometryPoint&sr=102100

waldoj commented 8 years ago

Oh, that's very interesting. Let's shop this around to some folks who know Esri's RESTful API well enough to weigh in!

waldoj commented 8 years ago

(It's funny—I went one level deeper than the website to use their internal API, but it never occurred to me to look one level deeper still. I felt smug enough my initial, minimal accomplishment that I stopped thinking critically.)

waldoj commented 8 years ago

I mentioned this to @tmcw and, being @tmcw, he just went ahead and whipped up this solution. :) The next challenge is to either integrate his code (which he's kindly provided under an MIT license) or rewrite it in Python, using Mercantile.

webmaven commented 8 years ago

:100: :clap:

Now the code just needs to step through the bounding box at set intervals.

Not sure what the resolution should be if we want to reconstruct shapefiles rather than end up with a huge x,y,zone table.

Thought: A limited POC could do it just within the bounding box for a single Zipcode.

waldoj commented 8 years ago

Yeah, the nice thing about using ZIPs is that I didn't have to consider density, how to limit queries to land, or really anything other than getting a list of ZIPs. I might—God help me—have to actually learn something about working with geodata.

webmaven commented 8 years ago

:scream:

waldoj commented 8 years ago

Due to #7, we have to use a different method now: #8.