Skip to contents

Reading and writing spatial data

get_location()
Get location of a specified type based on name, id, or location
get_location_data() map_location_data()
Get data for a location
get_static_mapbox() get_osm_static_mapbox() get_location_static_mapbox()
Use mapboxapi to get a static Mapbox map image
read_sf_ext() read_sf_pkg() read_sf_path() read_sf_excel() read_sf_csv() read_sf_url() read_sf_geojson() read_sf_gist() read_sf_gmap() read_sf_download() read_sf_gsheet()
Read spatial data in a bounding box to a simple feature object
write_sf_ext() write_sf_cache() write_sf_gist() write_sf_gsheet()
Write or cache a simple feature object to a file
read_sf_exif() write_exif() write_exif_keywords()
Read location data from images to a simple feature object using EXIF or write EXIF metadata

Access spatial data from online sources

get_esri_data() get_esri_layers() get_esri_metadata()
Use esri2sf to get data from an ArcGIS FeatureServer or MapServer for a location
get_osm_data() get_osm_id() get_osm_boundaries()
Use osmdata to get Open Street Map data for a location
osm_building_tags
OpenStreetMap building tags
get_wiki_data()
Get Wikipedia articles for a location
get_open_data() get_socrata_data()
Get data from an open data portal (Socrata) for a location
get_flickr_photos()
Use FlickrAPI to get geotagged photos for a location
get_states() get_counties()
Get U.S. State and County boundary data for a location
us_states
U.S. State boundaries (1:5 mi scale, bbox and wkt)
us_counties
U.S. County boundaries (1:5 mi scale, bbox and wkt)
set_access_token() get_access_token()
Set or get an access token or API key to/from environment variables.

Check, convert, or modify the geometry of simple feature objects

is_sf() is_sfc() is_sfg() is_bbox() is_sf_list() is_raster() is_sp() is_same_crs() is_sf_or_what()
What is the class or spatial attributes of this feature?
is_geom_type() is_point() is_multipoint() is_line() is_multiline() is_polygon() is_multipolygon()
What geometry type is this feature?
as_point() as_points() as_startpoint() as_endpoint() as_line() as_lines() as_polygons()
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_list() as_sf_class()
Convert an object to a simple feature or bounding box object
sf_to_df() df_to_sf() check_coords() has_coords()
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
sf_bbox_asp() sf_bbox_point() sf_bbox_dist() sf_bbox_xdist() sf_bbox_ydist() sf_bbox_diagdist() sf_bbox_transform() sf_bbox_to_sf() sf_bbox_to_sfc() sf_bbox_to_wkt() sf_bbox_to_lonlat_query() sf_bbox_shift() sf_bbox_contract() sf_bbox_expand()
Measure, transform, and convert bounding boxes
st_bbox_ext() st_bbox_asp()
Get a bounding box buffered to match an aspect ratio
st_buffer_ext() st_edge()
Buffer a simple feature or bounding box object
st_transform_ext() st_omerc()
Transform or convert coordinates of a simple feature or bounding box object
st_erase() st_trim()
Erase an area of a simple feature object
st_clip()
Clip the side or corner of a simple feature or bounding box object
st_scale_rotate() st_center() st_square() st_inscribed_square() st_circle() st_circumscribed_circle()
Modify the geometry of a simple feature or bounding box object
st_cast_ext()
Cast geometry to another type

Create or modify simple feature objects

make_location_data_list()
Make a list of data and corresponding locations
make_location_grid()
Make a grid over a location bounding box
location_filter()
Filter, crop, or trim data to a location
get_coords() get_minmax()
Get coordinates for a simple feature or bounding box object
get_area() get_length() get_dist() get_bearing()
Get measurements for simple feature objects
format_data() rename_with_xwalk() fix_date() relocate_sf_col() rename_sf_col() bind_address_col() bind_block_col() bind_boundary_col() bind_units_col()
Format data frames and simple features using common approaches
make_markers()
Make map markers from a simple feature object
number_features() sort_features()
Sort and number features by coordinates or distance
count_features()
Count simple feature objects
mapview_col() mapview_yn() mapview_exif() mapview_flickr() make_img_leafpop()
Use mapview to interactively explore spatial data

Spatial layers for ggplot2 maps

layer_frame() make_frame()
Create map layer with shape framing a simple feature object
layer_icon() geom_sf_icon()
Add a SVG icons to a ggplot2 plot based on a simple feature object
layer_location_data()
Layer location data into a ggplot2 map
layer_mapbox()
Use mapboxapi to make a Mapbox static map layer
layer_markers() layer_numbers()
Create a ggplot2 layer with map markers or numbered markers
layer_mask()
Create a mask layer based on a simple feature object
layer_neatline()
Set map limits to a simple feature or bounding box with a specified distance buffer, aspect ratio, and panel border
layer_scaled()
Create a ggplot2 layer scaled to a paper and orientation for a location
make_location_map() make_social_map() make_image_map()
Make a ggplot map using layer_location_data

Working with ggplot2 themes, labels, and file export

is_gg_layer() is_gg_sf_layer() is_gg_scale() is_gg_theme() is_gg_component() is_gg_list()
Check ggplot objects and ggplot lists
theme_text() theme_margin() theme_legend()
Modify the text, margins, or legend for a ggplot theme
labs_ext()
Add labels to a ggplot2 location map
scale_group_data() group_data_pal() get_group_data_pal_scale()
Create discrete fill and color scales for grouped data
ggsave_ext() ggsave_social() gtsave_ext()
Save a ggplot2 plot or gt table to file and update file EXIF metadata
make_filename()
Make file name and path with optional label, prefix, or postfix
get_data_dir() create_data_dir()
Check data directory and create if needed
str_trim_squish() str_fix() str_prefix() str_pad_digits() str_extract_digits() str_add_filetype() str_remove_filetype() str_extract_filetype()
Use the stringr package to help make consistent file names
set_overedge_options()
Set overedge packge options

Unit and formatting utilities

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()
General utility functions for working with distance units objects
convert_dist_scale()
Convert distance from scale to actual units
convert_dist_units()
Convert distance (and area) values between different units
get_paper()
Get standard paper and image sizes
get_social_image()
Get social media image size to match platform and format
get_margin()
Get margins for a ggplot2 plot or map based on style or distance
get_scale()
Get standard scales and convert to scale distances
get_asp()
Get aspect ratio from string or based on specific paper and margins

Reference data for mapping and formatting

map_icons
Map icons
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