1

The following code shows the dataset I am working with:

library(maps)
CountyMapData <- map_data("county")
head(CountyMapData)

       long      lat group order  region subregion
1 -86.50517 32.34920     1     1 alabama   autauga
2 -86.53382 32.35493     1     2 alabama   autauga
3 -86.54527 32.36639     1     3 alabama   autauga
4 -86.55673 32.37785     1     4 alabama   autauga
5 -86.57966 32.38357     1     5 alabama   autauga
6 -86.59111 32.37785     1     6 alabama   autauga

There are several cities in Virginia which are independent and not part of counties. For example, Alexandria City and Bristol City. I would like to be able to have polygons for these too.

Is there a dataset such as the above that includes independent cities but is otherwise at the county-level?

2

Why not just use county shapefiles from the Census Bureau? The Census recognizes those independent Virginia cities as both cities and as independent counties for the purposes of geographic distinction. Here is a list of the areas designated at the county level by the Census Bureau for the state of Virginia. You can find shapefiles for all counties here.

| improve this answer | |
0

If you are happy with the resolution provided by the GADM database, then you can easily download that data using the convenience function raster::getData().

(Do note: In addition to loading US county-level data as a SpatialPolygonsDataFrame to the current R session, the code below will also save the data for future use to a file named USA_adm2.Rdata and located in your current working directory.)

## Download the data
library(raster)
counties <- getData(name="GADM", country="USA", level=2)

## Extract and plot the Virginia counties & independent cities, to show this works
va_counties <- subset(counties, NAME_1=="Virginia")
va_ind_cities <- subset(va_counties, TYPE_2=="Independent City")
plot(va_counties)
plot(va_ind_cities, col="red", add=TRUE)

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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