Coder Social home page Coder Social logo

quantifish / nzsf Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 4.0 602.06 MB

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

R 2.15% HTML 97.85%
shapefiles ggplot2 spatial-features new-zealand mapping maps tidyverse dplyr

nzsf's People

Contributors

cttedwards avatar quantifish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nzsf's Issues

CRA

make a function for figs and add PHC

CRS definition

change proj_nzsf() to return CRS(SRS_string = "EPSG:9191")

ggmap rasters

# 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)

Reduce the size of the data files

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

Issue with scales and north arrow

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.

LIN QMA polygons don't line up with statistical areas

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)

image

Also, there are some polygon slivers in the north island which I couldn't get rid of with snap or simplify.

Show different annotations

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")

File size issues

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:

image

create a set of grids/rasters based on spec

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.