USEPA / EPATADA

This R package can be used to compile and evaluate Water Quality Portal (WQP) data for samples collected from surface water monitoring sites on streams and lakes. It can be used to create applications that support water quality programs and help states, tribes, and other stakeholders efficiently analyze the data.
https://usepa.github.io/EPATADA/
Creative Commons Zero v1.0 Universal
39 stars 18 forks source link

Add leaflet Interactive Layer Display to TADA_ViewATTAINS() #492

Open mhweber opened 2 months ago

mhweber commented 2 months ago

Is your feature request related to a problem? Please describe: It seems it would be useful to allow toggling layers in leaflet map on and off in TADA_ViewATTAINS() and potentially TADA_OverviewMap(). This would be moderately useful for existing mapping function(s), and could incorporate switching base maps, but would be critical if TADA_ViewATTAINS() or other mapping functions in EPATADA allowed incorporation of user-supplied spatial features (which would be a great addition).

Describe the solution you'd like: If it is not already in process (I didn't see) and desirable, it would be easy to show / hide layers using addLayersControl. For instance in GeospatialFunctions.R in TADA_ViewATTAINS() it would be easy to modify the map object with something like:

map %>%
  addLayersControl(
      baseGroups = c(("OSM (default)", "Toner", "Toner Lite"),
      overlayGroups = c(https://rdrr.io/r/base/c.html)("ATTAINS_catchments", "ATTAINS_points","ATTAINS_lines","ATTAINS_polygons"),
      options = layersControlOptions(collapsed = FALSE)
    )

I would be happy to put in a PR for this if the EPATADA team thought this would provide useful functionality. I would also be interested in contributing to efforts to incorporate user-supplied spatial features but this may already be in the works.

Reminders for TADA contributors addressing this issue:

New features and/or edits should include all the following work:

hillarymarler commented 1 month ago

@mhweber - we had a chance to discuss this at our last team meeting and would welcome a PR from you on this as we don't currently have a way to support user-supplied spatial features in existing TADA mapping functions.

mhweber commented 1 month ago

@hillarymarler - great! I'll try to put in a PR for this soon

cristinamullin commented 6 days ago

@kathryn-willi FYI Marc is also working on some updates to TADA_ViewATTAINS()

@mhweber Both functionalities, allowing toggling of layers and incorporation of user-supplied spatial features, are very helpful and welcomed additions! Users have specifically asked for this - for example so they could add their up-to-date assessment units and then match those with WQP sites (instead of the ones in ATTAINS that may be are outdated). Visualizing other layers may be helpful for making decision to include/exclude a site in analyses, or may assist with assessment unit development/segmentation, or understanding/sourcing wq issues.

The ROSSyndicate lab (@kathryn-willi, @mbrousil and others) at Colorado State has been working on updates to the geospatial functions as well. See their most recent PR here: https://github.com/USEPA/EPATADA/pull/521. If you have time, I just added you as a reviewer because this overlaps with the work you’re doing. They modified both TADA_GetATTAINS and TADA_ViewATTAINS. I hope it is not too much effort to merge your updates with theirs. Depending on timing, it may may sense to merge both of you PRs before merging all updates into EPATADA develop.

TADA_GetATTAINS currently links catchment-based ATTAINS assessment unit data (EPA snapshot of NHDPlus HR catchments associated with entity submitted assessment unit features - points, lines, and polygons) to Water Quality Portal observations. The new functionality ROSSyndicate added should allow users to essentially visualize/create new assessment units that are the NHD catchments for WQP observations that do not have any ATTAINS assessment units associated with them yet. Or it would allow users to investigate how much land/what areas are “not assessed” in ATTAINS (under CWA) but do have WQP data available for assessments.