**Update for 2023!! This API now returns GeoJSON in EPSG 4326!
This is an API for returning high resolution state and county boundaries by state. This API uses the state FIPS code to generate a GeoJSON of that states administrative boundaries. If you don't have your state FIPS memorized (shame on you!) you can use the table below. As an example here are the queries for Utah:
State boundary:
https://geojson-cloud-api.appspot.com/states?fips=49
County boundaries:
https://geojson-cloud-api.appspot.com/counties?fips=49
To change this to a different state simply change the number at the end to your desired state's FIPS. To interface this API with QGIS navigate to Layer -> Add Layer -> Add Vector Layer
, then select the Protocol HTTP button and input the address above into the URI box. To use this API with RStudio you will need the SF library. Here is complete code to load Utah into a RStudio session:
library(sf)
utah <- st_read("https://geojson-cloud-api.appspot.com/states?fips=49")
This can also be done in Python using the json and urllib libraries. Please see the complete code sample below:
import json
from urllib.request import urlopen
response = urlopen("https://geojson-cloud-api.appspot.com/states?fips=49")
utah = json.loads(response.read())
This API will also return all state or county lines in one GeoJSON, but heavily generalized. This is ideal for visualizing data on a larger scale where higher resolution is not required:
https://geojson-cloud-api.appspot.com/states/all
https://geojson-cloud-api.appspot.com/counties/all
Thanks and happy mapping!
-Will Wiskes (made with <3 in Python & Flask)
Name | Postal Code | FIPS |
---|---|---|
Alabama | AL | 01 |
Alaska | AK | 02 |
Arizona | AZ | 04 |
Arkansas | AR | 05 |
California | CA | 06 |
Colorado | CO | 08 |
Connecticut | CT | 09 |
Delaware | DE | 10 |
District of Columbia | DC | 11 |
Florida | FL | 12 |
Georgia | GA | 13 |
Hawaii | HI | 15 |
Idaho | ID | 16 |
Illinois | IL | 17 |
Indiana | IN | 18 |
Iowa | IA | 19 |
Kansas | KS | 20 |
Kentucky | KY | 21 |
Louisiana | LA | 22 |
Maine | ME | 23 |
Maryland | MD | 24 |
Massachusetts | MA | 25 |
Michigan | MI | 26 |
Minnesota | MN | 27 |
Mississippi | MS | 28 |
Missouri | MO | 29 |
Montana | MT | 30 |
Nebraska | NE | 31 |
Nevada | NV | 32 |
New Hampshire | NH | 33 |
New Jersey | NJ | 34 |
New Mexico | NM | 35 |
New York | NY | 36 |
North Carolina | NC | 37 |
North Dakota | ND | 38 |
Ohio | OH | 39 |
Oklahoma | OK | 40 |
Oregon | OR | 41 |
Pennsylvania | PA | 42 |
Rhode Island | RI | 44 |
South Carolina | SC | 45 |
South Dakota | SD | 46 |
Tennessee | TN | 47 |
Texas | TX | 48 |
Utah | UT | 49 |
Vermont | VT | 50 |
Virginia | VA | 51 |
Washington | WA | 53 |
West Virginia | WV | 54 |
Wisconsin | WI | 55 |
Wyoming | WY | 56 |
Puerto Rico | PR | 72 |
^ ^
(O,O)
( )
-"-"---wtw-