Skip to contents

Read and write spatial data

read_sf_ext() read_sf_pkg() read_sf_path() read_sf_zip() read_sf_rdata() read_sf_query() read_sf_excel() read_sf_csv() read_sf_url() read_sf_esri() read_sf_felt() read_sf_gist() read_sf_gmap() read_sf_download() read_sf_gsheet()
Read spatial data in a bounding box to a simple feature object from multiple sources
write_sf_ext() write_sf_list() write_sf_cache() write_sf_gist() write_sf_gsheet()
Write or cache a simple feature object to a file
write_sf_svg()
Write an sf object to an svg file
read_sf_exif()
Read EXIF metadata to create a simple feature object or write EXIF metadata to image files
write_exif_from()
Write EXIF data for photos on spatial join with a sf object or list of sf objects
get_data_dir() list_data_files() superseded
Check if data directory exists and create a new directory if needed

Check and convert sf, sfc, and bbox objects

is_sf() is_sfg() is_sfc() is_bbox() is_raster() is_sp() is_geo_coords()
What is the class or spatial attributes of this feature?
check_sf()
Check if x is an sf object
is_geom_type() is_point() is_multipoint() is_line() is_multiline() is_polygon() is_multipolygon() st_is_ext()
What geometry type is this feature?
as_point() as_points() as_startpoint() as_endpoint() as_line() as_lines() as_polygons() as_centroid()
Convert an sf, numeric, or other object to a POINT (sfg) or POINT, MULTIPOINT, LINESTRING, or MULTILINESTRING (sfc) object
as_sf() as_bbox() as_sfc() as_sf_class()
Convert an object to a simple feature or bounding box object
as_sf_list() new_sf_list() is_sf_list() sf_list_rbind() map_as_sf_list() map_as_sf()
Creating and checking sf lists
as_xy()
Convert data to a data frame with X/Y coordinate pairs
as_crs() is_same_crs() is_wgs84()
Convert object to coordinate reference system or check coordinate reference system

Converting sf and data frame objects

sf_to_df() df_to_sf()
Convert between simple feature and data frame objects
address_to_sf()
Use tidygeocoder to convert an address or data frame with an address column to an sf object
coords_to_sf() check_coords() rev_coords() has_coords() format_coords() separate_coords()
Convert a data.frame with one or more coordinate columns to an sf object
lonlat_to_sfc() experimental
Convert a lon/lat or lat/lon coordinate pair to a sfc object

Modify sf, sfc, and bbox objects

st_bbox_ext() st_bbox_asp()
Get a bounding box buffered a set distance or to match an aspect ratio
st_buffer_ext() st_edge()
Buffer a simple feature or bounding box object
st_erase() st_trim()
Erase or trim geometry of a sf or sfc object
st_clip()
Clip the side or corner of a simple feature or bounding box object
st_concave_hull_ext()
Make a concave hull around simple feature object by attribute
st_union_ext() st_union_by()
Union simple feature objects and combine name column values
st_dissolve()
Dissolve geometry preserving existing or supplied grouping variables
st_join_ext()
Complete a spatial join using a simple feature objects or an object and list
st_filter_ext() st_filter_geom_type()
Filter, crop, trim, or erase a simple feature object or list
st_filter_pct() st_filter_pct_area() st_filter_pct_length() experimental
Filter by share of length or area of one geometry overlapping with a second geometry
st_center() st_circle() st_circumscribed_circle() st_donut()
Modify the geometry of a simple feature or bounding box object
st_square() st_inscribed_square()
Create a square within or around a simple feature object or collection
st_scale_rotate()
Scale and rotate a simple feature object, simple feature collection, or bounding box
st_nudge()
Nudge a simple feature to the center of another feature and/or a set distance
st_transform_ext() st_omerc() st_wgs84()
Transform or convert coordinates of a simple feature or bounding box object
st_make_valid_ext()
Checks if all geometries are already valid and make valid if not
st_cast_ext()
Cast geometry of a simple feature object or simple feature collection to another type
st_make_grid_ext()
Make a grid over a simple feature bounding box

Get information about sf, sfc, and bbox objects

get_coords() get_minmax()
Get coordinates for a simple feature or bounding box object
get_area() st_area_ext() get_length() st_length_ext() get_dist() st_distance_ext() get_bearing() st_bearing()
Get measurements for simple feature objects

Additional utility functions for sf and bbox objects

transform_sf() relocate_sf_col() rename_sf_col() get_sf_col() get_sf_colnames()
Additional utility functions for sf objects
number_features() number_sf() sort_features() sort_sf()
Sort and number features by coordinates or distance
count_features()
Count simple features based on relationship with a second simple feature object
count_sf_ext()
Count extended for working with sf objects
make_sf_grid_list()
Make a sf list by grid position
sf_bbox_corners()
Get bounding box corner points from a bbox, sfc, or sf object
sf_bbox_dist() sf_bbox_xdist() sf_bbox_ydist() sf_bbox_diagdist() sf_bbox_diag_ratio_to_dist() sf_bbox_asp() sf_bbox_orientation() sf_bbox_check_fit()
Measure a bounding box using x, y, or diagonal distance
sf_bbox_to_sf() sf_bbox_to_sfc() sf_bbox_transform() sf_bbox_point() sf_bbox_to_wkt() sf_bbox_to_lonlat_query() sf_bbox_to_npc()
Convert and tranform bounding boxes
sf_bbox_shift() sf_bbox_contract() sf_bbox_expand()
Shift sides, contract, or expand a bounding box
cli_format(<sf>)
cli_format style for sf objects

Utility functions for units and scales

is_dist_units() is_diff_dist() is_same_dist() is_longer() is_shorter() get_dist_units() as_dist_units() is_diff_area() is_same_area() is_same_units()
General utility functions for working with distance units objects
convert_dist_units()
Convert distance (and area) values between different units
convert_dist_scale()
Convert distance from scale to actual units
compare_dist()
Compare a distance to the dimension of a bounding box or another distance value
bind_units_col()
Bind units column to data frame
get_scale()
Get standard scales and convert to scale distances

Utility functions for paper and image sizes

get_paper() superseded
Get standard paper and image sizes
get_social_image()
Get social media image size to match platform and format
get_asp()
Get aspect ratio from string or based on specific paper and margins
get_margin()
Get margins for a ggplot2 plot or map based on style or distance

Helper functions for interactive mapping

mapview_ext() mapview_exif() mapview_popup_img()
Use mapview to interactively explore spatial data
rdeck_edit() rdeck_select() editor_options()
rdeck editor

Reference data for units, scales, and paper

dist_units
Distance units (data frame)
dist_unit_options
Distance units (vector)
area_unit_options
Area units (vector)
standard_scales
Standard map, architectural, and engineering scales
paper_sizes
Standard paper and image sizes