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?


2 Answers 2

  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:


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.