Load dataset sbais
which got ingested from raw data at data-raw/2018-06-01_2018-06-07
by data-raw/sbais.R
using read_ais_txt()
in R/read.R
.
And get top 20 vessels with data.
library(tidyverse)
library(shipr)
# devtools::install_local(force=T)
# devtools::document()
# devtools::load_all()
# show sbais dataset, lazy loaded
sbais
#> # A tibble: 617,742 x 8
#> datetime name ship_type mmsi speed lon lat heading
#> <dttm> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 2018-06-01 00:00:00 SM SEAHA… 80 35565… 18 -112. 22.0 300
#> 2 2018-06-01 00:00:00 ZANTE 74 63601… 21.4 -116. 29.2 167
#> 3 2018-06-01 00:00:00 CSCL WIN… 71 47711… 11.4 -120. 34.2 103
#> 4 2018-06-01 00:00:03 SUEZ RAJ… 80 53800… 12.3 -119. 33.0 222
#> 5 2018-06-01 00:00:03 ROSS CHO… 32 36634… 5.5 -121. 33.8 323
#> 6 2018-06-01 00:00:06 CHIQUITA… 79 63601… 16.4 -119. 33.9 142
#> 7 2018-06-01 00:00:08 BORACAY … 70 37459… 10.2 -119. 33.9 118
#> 8 2018-06-01 00:00:11 NOT NAMED 00 35531… 10.4 -122. 34.4 80
#> 9 2018-06-01 00:00:11 CAPT.T.LE 42 36710… 16.4 -119. 34.1 511
#> 10 2018-06-01 00:00:13 CMA CGM … 79 23200… 18.1 -121. 34.6 320
#> # … with 617,732 more rows
# explicitly attach to environment
data(sbais)
sbais %>%
group_by(name) %>%
summarize(n = n()) %>%
arrange(desc(n)) %>%
head(20) %>%
DT::datatable()
lims <- get_ship_limits(segs, limit_knots = 10, ship_name, dir_data = dir_cache)
# show limits table
lims
#> Simple feature collection with 2 features and 5 fields
#> geometry type: MULTILINESTRING
#> dimension: XY
#> bbox: xmin: -119.9482 ymin: 32.6282 xmax: -118.2305 ymax: 33.95608
#> epsg (SRID): 4326
#> proj4string: +proj=longlat +datum=WGS84 +no_defs
#> # A tibble: 2 x 6
#> label min km geometry pct_dist pct_time
#> * <chr> <dbl> <dbl> <MULTILINESTRING [°]> <dbl> <dbl>
#> 1 > 10 k… 1326. 472. ((-119.9337 32.6344, -119.7547 32.… 49.8 25.8
#> 2 <= 10 … 3805. 475. ((-119.9482 32.6282, -119.9435 32.… 50.2 74.2
map_ship_limits(lims)
Here’s an example of using these functions together to create:
ship_gauge()
and ship_box()
in R/viz.R
:
Filter based on shipping lane area. Where are lanes shapefile or larger area to be defined as recommended slowdown area?
Compare average vessel speed inside and outside the slowdown area.
Convert km per hour (kmhr
) to knots in segment outputs.
Loop through rendering all ship cards using parameterized ship_card.Rmd
Create directory page to ship cards and summary table of ship stats.
Relate ships to organizations.
Provide overview statistics for study area.