Skip to content

Tools to merge USDA Plant Hardiness Zone shapefile and ZIP Code latitude/longitude data.

Notifications You must be signed in to change notification settings

StateAndPlain/zip2zone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motivation

A project required a US ZIP Code to Plant Hardiness Zone mapping database like the USDA Agricultural Research Service provides, but the project did not have the budget to purchase the 19 region GIS shapefiles at $149.95 each (late 2014 pricing).

The Open Plant Hardiness Zones project contributors did the heavy lifting of rasterizing the publicly available high resolution maps that are available free of charge.

This tool combines a data source of US ZIP Code to latitude/longitude mappings with the OPHZ shapefiles to create a database mapping US ZIP Codes to Plant Hardiness data.

There are several sources for US ZIP Code to latitude/longitude coordinates, some of which require a small fee depending on your usage, so this tool does not automatically include one. Indeed, per a discussion on GIS Stack Exchange there are a number of reasons asking for a ZIP Code to coordinate mapping doesn't make sense.

Required Software

I installed sqlite3, spatialite and spatialite-tools using Homebrew on Mac OS X 10.9.

Tip: to get the spatialite formulae you must first brew tap homebrew/homebrew-science.

Tip: On Mac OS X 10.9 I had to gem uninstall sqlite3 and then gem install sqlite3 -- --with-sqlite3-include=/usr/local/Cellar/sqlite/3.8.7.1/include --with-sqlite3-lib=/usr/local/Cellar/sqlite/3.8.7.1/lib to get the sqlite3 gem to build against the homebrew installed sqlite3 instead of the OS-installed one.

Usage

  1. Acquire a CSV mapping ZIP Codes to Latitude / Longitude. Options include:
  2. Convert the data into a CSV file with the fields ZIP Code, Latitude, Longitude, in that order, including column headers. Excel, Google Docs Spreadsheet and OpenOffice are all decent tools to use for this purpose. Save the file as zip2latlong.csv at the root of this directory.
  3. Run bundle install.
  4. Run rake load_shapes.
  5. Run rake zip2zone. Get a beverage of your choice and wait.

Congratulations! You should have a GDBM in zip2zone.gdbm with the keys being ZIP Codes and the values being JSON-encoded objects with the keys zone and temp.

Acknowledgements

I'm guessing the GIS rasterization of the high resolution images available from http://planthardiness.ars.usda.gov/PHZMWeb/ required a lot of work. For that effort I am grateful.

About

Tools to merge USDA Plant Hardiness Zone shapefile and ZIP Code latitude/longitude data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages