quantifish / nzsf Goto Github PK
View Code? Open in Web Editor NEWNew Zealand Spatial Features (nzsf) is a package for creating scientific maps in New Zealand waters.
Home Page: http://www.quantifish.co.nz/nzsf/
License: Other
New Zealand Spatial Features (nzsf) is a package for creating scientific maps in New Zealand waters.
Home Page: http://www.quantifish.co.nz/nzsf/
License: Other
make a function for figs and add PHC
Add requirement for packages "rmarkdown", "tidyverse", "ggspatial", "viridis", l"wgeom", "rnaturalearthdata", and "patchwork" to allow (vignette) building from source (in cases where not installed).
change proj_nzsf()
to return CRS(SRS_string = "EPSG:9191")
It is actually 2 plots. One look bad, the other is a standard grid so can remove or move to the standard grid Rmd.
Suggest that CCAMLR and CCSBT have their own vignettes. Add CCAMLR land (see https://gis.ccamlr.org/). Anything else from CCAMLR that needs to be added?
# https://stackoverflow.com/questions/47749078/how-to-put-a-geom-sf-produced-map-on-top-of-a-ggmap-produced-raster
library(ggplot2)
library(ggmap)
library(sf)
nc_map <- get_map("north carolina", maptype = "satellite", zoom = 6, source = "google")
st_crs(nc_map)
# Coordinate Reference System: NA
# assume the coordinate refence system is 3857
plot(st_transform(nc_shp, crs = 3857)[1], bgMap = nc_map)
Add sticker to the main help page. And write a main help page too.
They are huge at:
❯ checking installed package size ... NOTE
installed size is 127.9Mb
sub-directories of 1Mb or more:
data 126.4Mb
doc 1.3Mb
An issue seems to have come up in a recent update of ggspatial
. This issue is in both the nzsf.Rmd
and lobster.Rmd
vignettes. I've had to turn off the lines
annotation_scale(location = "br", unit_category = "metric") +
and change the line
annotation_north_arrow(location = "tl", which_north = "true", style = north_arrow_nautical) +
to
annotation_north_arrow(location = "tl", style = north_arrow_nautical) +
It seems to be an issue with these functions and coord_sf
.
Look at this as an alternative to what I have coded.
Add any environmental layers that I can get my hands on.
aa <- nz_fisheries_general_statistical_areas %>%
dplyr::select(Statistica) %>%
st_transform(crs = proj_nzsf()) %>%
# st_snap(x = ., y = ., tolerance = 0.0001) %>%
# st_simplify(dTolerance = 1) %>%
st_union(by_feature = TRUE) %>%
mutate(area = case_when(
Statistica %in% c(401:412, "049", "050", "051", "052") ~ "a",
Statistica %in% 601:625 ~ "b",
TRUE ~ as.character("c")
)) %>%
group_by(area) %>%
summarize(geometry = st_union(geometry))
ggplot() +
geom_sf(data = aa, aes(fill = area)) +
plot_qma(qma = "LIN", fill = "transparent") +
# plot_statistical_areas(area = "stat area", fill = "transparent") +
# plot_coast(resolution = "med", fill = "forestgreen", colour = "black", size = 0.3) +
annotation_north_arrow(location = "tl", which_north = "true", style = north_arrow_nautical)
Also, there are some polygon slivers in the north island which I couldn't get rid of with snap or simplify.
Check the vignette as the JMA statistical areas look wrong
Show them and then remove from most plots.
annotation_north_arrow(location = "tl", which_north = "true") +
annotation_scale(location = "br", unit_category = "metric")
+
annotation_north_arrow(location = "tr", which_north = "true",
style = north_arrow_nautical) +
annotation_scale(location = "br", unit_category = "metric")
The size of some of the files in data
is too big:
> checking installed package size ... NOTE
installed size is 95.9Mb
sub-directories of 1Mb or more:
data 94.6Mb
doc 1.1Mb
0 errors ✓ | 0 warnings ✓ | 1 note x
R CMD check succeeded
I could get rid of the New Zealand coastline shapefiles and replace with:
nz <- ne_countries(scale = "medium", returnclass = "sf") %>%
st_transform(proj_nzsf()) %>%
st_crop(get_statistical_areas(area = "EEZ"))
But the scale = "large
requires another package that appears difficult to install. May be best to leave this until that package is updated. Other big files include:
Not sure why but ymin in get_standard_grid_origin
is way below the NZ EEZ in the vignette.
See the document A standardised approach for creating spatial grids for New Zealand marine environment and species data
. Use this to derive a raster grid and a polygon grid for different grid sizes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.