[GIS] Creating Zip Code-Level Choropleth Using Leaflet.JS

choroplethleafletzip-codes

I am new to Leaflet.js.

Is it possible to create a choropleth using zip-code level data?

I've seen plenty of choropleth examples using state-level data and even a few using county-level data.

If so, what would be a good way to go about it using Leaflet?

Do I need to obtain coordinates for the shapes of each zip code I'm interested in visualizing?

Best Answer

  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.