Closed nstauffer closed 8 months ago
Thanks @nstauffer . I believe the bug occurs here because the geometry column name is not geometry
, so a quick fix for you is to run
sf::st_geometry(strata) <- "geometry"
See here for more.
We do plan to fix this bug in the next CRAN submission (and allow for arbitrary geometry names), but I will leave the issue open until we push a fix.
That worked like a charm, thanks! I try to be vigilant for that particular issue because it often gives me heartburn trying to combine sf objects, but it didn't cross my mind this time.
@nstauffer one other note: see spsurvey::sp_rbind()
for combining sites
objects from grts()
output.
@nstauffer We have implemented a more permanent solution, which is available in the development version of spsurvey
you can download by running
devtools::install_github("USEPA/spsurvey", ref = "develop")
This bug fix will be included in the next CRAN submission (the current version of CRAN is 5.5.0).
@nstauffer The fix is now on CRAN.
I've been trying to use the legacy sites argument to balance a set of points around another set of points, e.g., taking an existing sampling design in an area as legacy points and drawing a new design including all those legacy points plus new points then keeping only the new points as a supplemental design. But! I've run into an issue where using
legacy_sites
results in the output looking normal, but the lat_WGS84 and lon_WGS84 variables inoutput$sites_base
andoutput$sites_over
are allNaN
.There are no outright errors reported, but I get the following warnings which appear to have to do with identifying the extent of the bounding box for one of the spatial objects.
This happens regardless of if I'm stratifying or not and I've done everything I can to make sure there are no geometry errors or irregularities in the polygons with both
sf::st_buffer()
andsf::st_make_valid()
. I also get numeric values as expected from both my frame and legacy sites when usingsf::st_bbox()
. And I can get it to produce valid points as long as I don't uselegacy_sites
. I've gone rooting around to see if I can identify where things are going sideways withingrts()
but haven't been able to turn up a starting point.The attached file contains a geodatabase with the polygons I've been using. Below should produce the warnings and the wonky, coordinate-less outputs.