Skip to contents

View vessel locations and fishery zones on interactive map.

Usage

map_viewer(
  dat,
  project,
  spat,
  avd,
  avm,
  num_vars,
  temp_vars,
  id_vars,
  lon_start,
  lat_start,
  lon_end = NULL,
  lat_end = NULL
)

Arguments

dat

Primary data containing information on hauls or trips. Table in FishSET database contains the string 'MainDataTable'.

project

Project name.

spat

Spatial data containing information on fishery management or regulatory zones. Shape, json, geojson, and csv formats are supported.

avd

Variable name in the primary data file that gives the unique ID associated to the polygon.

avm

The name of the property in the GeoJson file that identifies the polygon to cross reference to dat. Variable name in the spatial file that represents the unique ID.

num_vars

List, name of numeric variable(s) in dat to include for plotting.

temp_vars

List, name of temporal variable(s) in dat to include for plotting.

id_vars

List, name of categorical variable(s) in dat to group by.

lon_start

String, variable in dat that identifies a single longitude point or starting longitude decimal degrees.

lat_start

String, variable in dat that identifies a single latitude point or starting latitude decimal degrees.

lon_end

String, variable in dat that identifies ending longitude decimal degrees.

lat_end

String, variable in dat that identifies ending latitude decimal degrees.

Details

The map_viewer function creates the files required to run the MapViewer program. Users can map points or trip path. To plot points, leave lon_end and lat_end and NULL. After creating the inputs, a map with zones is opened in the default web browser. To close the server connection run servr::daemon_stop() in the console. Lines on the map represent the starting and ending lat/long for each observation in the data set color coded based on the selected variable. It can take up to a minute for the data to be loaded onto the map. At this time, the map can only be saved by taking a screen shot.

Examples

if (FALSE) {
# Plot trip path
map_viewer(scallopMainDataTable, 'scallop', "scallopTMSSpatTable", 
           avd = 'ZoneID', avm = 'TEN_ID', num_vars = 'LANDED_thousands', 
           temp_vars = 'DATE_TRIP', lon_start = 'previous_port_lon', 
           lat_start = 'previous_port_lat', lon_end = 'DDLON', 
           lat_end = 'DDLAT')
   
# Plot observed fishing locations        
map_viewer(scallopMainDataTable, 'scallop', "scallopTMSSpatTable", 
           avd = 'ZoneID', avm = 'TEN_ID', num_vars = 'LANDED_thousands', 
           temp_vars = 'DATE_TRIP', lon_start = 'DDLON', lat_start = 'DDLAT')

#Plot haul path
map_viewer(pollockMainDataTable, 'pollock', spat=spatdat, avd='NMFS_AREA',
avm='NMFS_AREA', num_vars=c('HAUL','OFFICIAL_TOTAL_CATCH'),
temp_vars='HAUL_DATE', id_vars=c('GEAR_TYPE', 'PORT'), 
       'Lon_Start', 'Lat_Start', 'Lon_End', 'Lat_End')

#Plot haul midpoint
map_viewer(pollockMainDataTable, 'pollock', spat=spatdat, avd='NMFS_AREA',
avm='NMFS_AREA', num_vars=c('HAUL','OFFICIAL_TOTAL_CATCH'),
temp_vars='HAUL_DATE', id_vars=c('GEAR_TYPE', 'PORT'), 'Lon_Mid', 'Lat_Mid')
}