Skip to content
Mapping with R has been completely revamped. Check it out →
R for the Rest of Us Logo

Mapping with R

Accessing Raw Geospatial Data

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

View code shown in video
library(sf)

read_sf(
  "https://raw.githubusercontent.com/rfortherestofus/mapping-with-r-v2/refs/heads/main/data/Portland_City_Council_Districts.shp"
)

read_sf(
  "https://raw.githubusercontent.com/rfortherestofus/mapping-with-r-v2/refs/heads/main/data/portland_city_council_districts.geojson"
)

Your Turn

  • Download data in ESRI Shapefile or GeoJSON format on Portland sextants (you can find the original data here)

  • Import the data in R using the read_sf() function from the sf package

  • Examine your data, making sure you can identify its geometry type, dimensions, bounding box, coordinate reference system and geometry column

Learn More

This vignette from the {sf} package covers all things reading and writing geospatial data. The Geographic Data I/O chapter of the book Geocomputation with R does something similar.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.