Creating Zip Code-Level Choropleth Using Leaflet.JS?

  1. Get a polygon feature class of the zip codes that you want to add

  2. Store your polygon zip code feature class in a RDBMS like PostGIS

  3. Encode your polygon zip code geometry objects to GeoJSON objects

  4. Create a GeoJSON layer and populate it with your GeoJSON objects

  5. Use the polygon extension of the path abstract class from Leaflet documentation to symbolize fill color, opacity etc. based on data either supplied by user or from your polygon feature class.


Check out a tutorial I wrote on my blog:

http://dillonshook.com/leaflet-zip-code-map-part-1/

Doing this dynamically requires some back-end setup to serve up the geoJSON with data joined