geoJSON US States and Counties

When working with maps and JavaScript, if you need to outline or shade states or counties on a map you need a huge list of coordinates that make up that shape. Sometimes it’s a single polygon but sometimes, like in the case of Alaska, it’s a MultiPolygon.

I’ve worked on more maps in the last couple months than I have in the last few years but haven’t ever been able to find all of the counties of the US in geoJSON/JSON format, only in KML or CSV.

This weekend I wrote a parser that takes the CSV’s that hold the data and creates individual files for each state as well as a master file for the whole US.

Enjoy!

All US State Boundaries

All US State County Boundaries

US County Boundaries State by State

19 thoughts on “geoJSON US States and Counties”

    1. Thanks for sharing Jeryl, this looks great! Since you’re using it as a service would you mind placing credit somewhere in the API or the front end? It took some work to get all of this prepared. Thanks!

  1. Would it be possible to use these files to query the coords of a specific county and only show that county on a map?

    1. Definitely. You could either download the state by state county files above and load just the state with the county you want to display, or you could download the ‘All US County Boundaries,’ assign that to a variable (eg: var counties = {{countiesObject}}) and then query that object for the county by state and then county name.

    1. Nothing is jumping out at me immediately, do you have any more context in the code that you could provide so I can help you debug it? Maybe something on Codepen or a collaborative platform like that?

  2. This was exactly what I was looking for – separate files of all counties state-by-state. Thanks!

    However, I had issues using them as-is with my d3.js application. When I checked them with GeoJSON Lint (http://geojsonlint.com), it returned 2 errors — the first polygon point has to the same as the last one, and the ‘features’ object needs to be a JSON array.

    I was able to write a sctipt to modify them and get everything working. I can send you updated files if you’re interested. Thanks again for your hard work!

Leave a Reply

Your email address will not be published.