View source: R/create-us-map.R
create_us_map | R Documentation |
create_us_map()
creates the modified shapefiles used by the
usmap package.
ea_crs()
returns the US National Atlas Equal Area coordinate reference system
(CRS) used by this package and usmap
.
transform2D()
computes a two dimensional affine transformation matrix
for the provided rotation angle and scale factor.
transform_alaska()
applies the appropriate transform for the Alaska polygons.
transform_hawaii()
applies the appropriate transform for the Hawaii polygons.
compute_centroids()
computes the modified centroids for each state or
county polygon using a center-of-mass technique on the largest polygon in
the region.
alaska_bbox()
returns the bounding box of Alaska pre-transformation.
hawaii_bbox()
returns the bounding box of Hawaii pre-transformation.
create_us_map(type = c("states", "counties"), input_file, output_file)
ea_crs()
transform2D(angle = 0, scale = 1)
transform_alaska(alaska)
transform_hawaii(hawaii)
compute_centroids(polygons, iterations = 3, initial_width_step = 10)
alaska_bbox()
hawaii_bbox()
Using these functions externally is not recommended since they make certain undocumented assumptions that may not work with all inputs.
It is strongly recommend that the usmap package is used directly.
In some cases where the raw data is required, the us_map and centroid_labels functions located in this package can be used instead.
Gert (2017). “How to calculate polygon centroids in R (for non-contiguous shapes).” https://gis.stackexchange.com/a/265475.
Rudis B (2014). “Moving The Earth (well, Alaska & Hawaii) With R.” https://rud.is/b/2014/11/16/moving-the-earth-well-alaska-hawaii-with-r/.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.