Need a quick Census TIGER/Line Shapefile for a map you are making? πŸ—Ί

Need a quick Census TIGER/Line Shapefile for a map you are making? πŸ—Ί

It is super easy to get using R and tigris and sf libraries. I often will run a command like this in R terminal to get a Shapefile of the of the counties in Maine.

library(sf)
library(tigris)

counties(‘me’, cb=T) %>% write_sf(‘/tmp/maine.shp’)

Other common tigris functions I will use is state, county_subdivision, tract, block_group and school_districts which work similarly. A resolution parameter can be supplied to control the resolution downloaded, the cb=T flag obtains cartographic boundaries which follow coast lines, rather then actual boundaries.

Leave a Reply

Your email address will not be published. Required fields are marked *