| Title: | Repair Functions for 'sf' Package Objects | 
| Version: | 0.2.2.0 | 
| Description: | A group of functions that support the 'sf' package, focused primarily on repairing polygons that break when re-projected. | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.2 | 
| Imports: | RCurl, rjson, mapview, sf, stringr, dplyr, ggplot2 | 
| Suggests: | testthat (≥ 3.0.0) | 
| Config/testthat/edition: | 3 | 
| NeedsCompilation: | no | 
| Packaged: | 2025-01-13 23:32:54 UTC; mr56267 | 
| Author: | Mark Ravina | 
| Maintainer: | Mark Ravina <mark.ravina@austin.utexas.edu> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-01-15 10:40:02 UTC | 
Geolocate historical toponyms
Description
This function uses the API for the World Historical Gazeteer to geolocate place names. It takes the place name and region as inputs and returns a data frame with results, primarily the longitude and latitude.
Usage
geolocate(df, place = "place", iso = "iso")
Arguments
| df | A data frame with two columns, places names and two-letter ISO codes for regions | 
| place | A column with toponyms in the data frame | 
| iso | A column of ISO codes for regions | 
Value
A data frame of the geospatial data
Examples
# Search for Paris and Edo (now Tokyo)
example.df <- data.frame("place" = c("Paris","Edo"), "iso" = c("FR","JP"))
geolocate(example.df)
Create and equal area grid for multiple maps
Description
Create and equal area grid for multiple maps
Usage
st_equal_grid(places, titles, buffer, map_theme)
Arguments
| places | a list of sf object | 
| titles | a character vector of title for the maps | 
| buffer | a numeric vector of buffer values | 
| map_theme | a ggplot theme | 
Value
A list of sf objects
Match and set geometry for a data frame
Description
This function sets the geometry in a target data frame based on matching values in a source data frame
Usage
st_match_geometry(source, target, match_field)
Arguments
| source | An sf data frame with a geometry column | 
| target | A data frame | 
| match_field | A column name (in quotes) for matching, shared by both data frames | 
Value
A sf data frame
Examples
a <- sf::st_polygon(list(rbind(c(-90,40),c(-90,50),c(-95,50),c(-95,40),c(-90,40))))
b <- sf::st_polygon(list(rbind(c(-80,30),c(-80,20),c(-70,20),c(-70,30),c(-80,30))))
ab <- sf::st_sfc(a,b)
sf::st_crs(ab) <- 4326
source.sf <- data.frame("match_field"=c("A","B"))
sf::st_geometry(source.sf) <- ab
target.df <- data.frame("match_field"=c("A","A","B","C"))
Create outline of sf projection
Description
Create outline of sf projection
Usage
st_transform_outline(crs)
Arguments
| crs | The crs for transforming the sf | 
Value
An sf object
Repair sf polygons
Description
Repair sf polygons
Usage
st_transform_repair(x, crs)
Arguments
| x | An sf object with unprojected coordinates | 
| crs | The crs for transforming the sf | 
Value
An sf object