Package 'picMaps'

Title: Mapping Utilities for The Pacific Ocean
Description: This package provides objects and functions for making plots and maps easier to create in the Pacific Ocean.
Authors: Devin S. Johnson
Maintainer: Devin S. Johnson <[email protected]>
License: CC0
Version: 0.1.9011
Built: 2025-01-28 17:19:17 UTC
Source: https://github.com/PIFSC-Protected-Species-Division/picMaps

Help Index


Functions To Aid Mapping of PIFSC Data

Description

This package is a collection of functions that helps gather spatial data for creating maps in the Pacific Ocean.

Package: picMaps
Version: 0.1.9011
Date: January 27, 2025
License: CC0
LazyLoad: yes

Note

This software package is developed and maintained by scientists at the NOAA Fisheries Pacific Islands Fisheries Science Center and should be considered a fundamental research communication. The recommendations and conclusions presented here are those of the authors and this software should not be construed as official communication by NMFS, NOAA, or the U.S. Dept. of Commerce. In addition, reference to trade names does not imply endorsement by the National Marine Fisheries Service, NOAA. While the best efforts have been made to insure the highest quality, tools such as this are under constant development and are subject to change.

Author(s)

Devin S. Johnson <[email protected]> (Maintainer)


Download ETOPO 2022 Bathymetery data

Description

Downloads bathymetery data for map making.

Usage

etopo_download(resolution = 60, force = FALSE)

Arguments

resolution

numeric resolution in arcsecs (one of 30, or 60). Defaults to 60 arcsecs.

force

Logical. If data has previously been downloaded, it will force a new download and update of the OSM data.

Author(s)

Devin S. Johnson

References

https://osmdata.openstreetmap.de/data/land-polygons.html


Extract Bathymetry Data From Downloaded ETOPO 2022 data.

Description

The majority of this function is taken from the topotools package here: https://github.com/BigelowLab/topotools/tree/main. It was modified to work within the 'picMaps' package.

Usage

etopo_rast(x, resolution = 60, proj = TRUE, ...)

Arguments

x

an sf spatial object that will define the extent of the bathymetry raster.

resolution

Resolution of the ETOPO bathymetry raster, either 60 or 30 arc-seconds. Defaults to resolution = 60.

proj

Logical. Should the resulting raster be projected to the same CRS as x? Defaults to project = TRUE.

...

Addtional arguments passed to terra::project.

References

  • NOAA National Centers for Environmental Information. 2022: ETOPO 2022 15 Arc-Second Global Relief Model. NOAA National Centers for Environmental Information. DOI: 10.25921/fd45-gt74. Accessed 2023-03-17.

  • https://github.com/BigelowLab/topotools/tree/main


Show picMaps Data Storage Directory

Description

This function provides the location where 'picMaps' is storing and retrieving spatial data.

Usage

get_data_loc()

Coast polygons for Main Hawaiian Islands

Description

Coast polygons for Main Hawaiian Islands

Usage

hawaii_coast(keep = 0.5, union = TRUE, crs = 4326)

Arguments

keep

see osm_coast

union

see osm_coast

crs

A coordinate system object, See st_transform. Defaults to ESPG = 4326 with 0-360 longitude values.


Hawaiian Island EEZ boundary polygon

Description

Hawaiian Island EEZ boundary polygon

Usage

hawaii_eez()

Calculate cellsize value for hexagon grid

Description

Calculates the appropriate cellsize argument for making a hexagon grid with st_make_grid.

Usage

hex_size(area = NULL, radius = NULL, sep = NULL)

Arguments

area

A value (m^2) for the resulting area of a full hexagon cell

radius

The value for the distance (m) from the centroids to the edge of full hexagon cells.

sep

The distance (m) between centoids of the hexagon grid.

Author(s)

Devin S. Johnson

References

See https://github.com/r-spatial/sf/issues/1505


Coast polygons for the Mariana Islands

Description

Coast polygons for the Mariana Islands

Usage

mariana_coast(keep = 0.5, union = TRUE, crs = 4326)

Arguments

keep

see osm_coast

union

see osm_coast

crs

A coordinate system object, See st_transform. Defaults to ESPG = 4326 with 0-360 longitude values


Mariana Islands US EEZ boundary polygon

Description

Mariana Islands US EEZ boundary polygon

Usage

mariana_eez()

Get A Coastline sf Polygon Object For Plotting and Mapping

Description

Uses downloaded OSM data for constructing an sf polygon coastline data object. Prior to using this function you must run osm_download.

Usage

osm_coast(x, keep = 0.2, union = FALSE)

Arguments

x

An sf spatial object. The coastline will be cropped to the bounding box.

keep

The amount of data retained after simplification with ms_simplify

union

Logical. Should the returned object be returned as a single sf MULTIPOLYGON object

Author(s)

Josh M. London and Devin S. Johnson


Download Open Street Map Coastline Shapefile from Daylight Map Distribution

Description

Downloads OSM data for plotting telemetry data and use distributions.

Usage

osm_download(force = FALSE, clean_shp = TRUE)

Arguments

force

Logical. If data has previously been downloaded, it will force a new download and update of the OSM data.

clean_shp

Logical. If 'TRUE' the original shape file will be deleted and only the '.gpkg' file will be retained.

Author(s)

Devin S. Johnson and Josh M. London

References

https://osmdata.openstreetmap.de/data/land-polygons.html


Download Open Street Map Coastline Shapefile from Daylight Map Distribution

Description

Downloads OSM data for plotting telemetry data and use distributions.

Usage

osm_install(zip_file, force = FALSE, clean_shp = TRUE)

Arguments

zip_file

path to the OSM data .zip file 'land-polygons-complete-4326.zip'. If left unspecified, the user will see a directory browser to navigate to it. See the url in the references to download it by hand. Also, see 'osm_download' to download and install it.

force

Logical. If data has previously been downloaded or installed, it will force a new install and update of the OSM data.

clean_shp

Logical. If 'TRUE' the original shape file will be deleted and only the '.gpkg' file will be retained.

Author(s)

Devin S. Johnson and Josh M. London

References

Get information here: https://osmdata.openstreetmap.de/data/land-polygons.html and download with this link https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip


Papahānaumokuākea boundary polygon

Description

Papahānaumokuākea boundary polygon

Usage

papahanaumokuakea()

Set Data Storage Directory

Description

The directory specified by path will be used to store downloaded spatial data. By storing the data in a separate directory from the installed package it will not need to be re-downloaded when the package is updated. You simply need to rerun this function to let the package functions know where the data is located.

Usage

set_data_storage(path = "~/.picmaps_data")

Arguments

path

A directory path specifying where spatial data will be stored for the package


sf::st_bbox for a list of sf or sfc objects.

Description

sf::st_bbox for a list of sf or sfc objects.

Usage

st_bbox_list(x, union = TRUE, as_sfc = FALSE)

Arguments

x

A list of sf or sfc objects.

union

Logical. Should the bounding box of the union be returned instead of a list of bounding boxes.

as_sfc

Logical. Should the bounding box (boxes) be returned as sfc objects.

Author(s)

Devin S. Johnson


Expand Spatial Bounding Box

Description

Expand an sf bounding box by an expansion factor

Usage

st_expand(bbox, ef)

Arguments

bbox

An sf bounding box. See sf::st_bbox.

ef

Expansion factor, must be positive and length 1, 2 or 4. If length(ef)==1 then the expansion factor is applied equally in all 4 directions. If length(ef)==2 then the first refers to the x coordinate and the second is associated with y coordinate expansion. If length(ef)==4 then then the first 2 refer to expansion to the west and east of the x coordinate, and the last to expand the y coordinate in the south and north direction respectively.

Author(s)

Josh M. London


Predicate function for st_filter

Description

Predicate function to use with st_filter such that such that elements of one spatial object are selected if they are not contained at all in the other. See sf::st_within

Usage

st_not_within(x, y, sparse = TRUE, prepared = TRUE, ...)

Arguments

x

object of class sf, sfc or sfg

y

object of class sf, sfc or sfg; if missing, x is used

sparse

ogical; should a sparse index list be returned (TRUE) or a dense logical matrix? See sf::st_within.

prepared

ogical; prepare geometry for x, before looping over y? See sf::st_within.

...

passed on to s2_options


sf::st_union for a list of sf or sfc objects.

Description

sf::st_union for a list of sf or sfc objects.

Usage

st_union_list(x)

Arguments

x

A list of sf or sfc objects.

Author(s)

Devin S. Johnson