-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update st_ll_sample
for regular sample on LINES
#725
Conversation
- Same code as in {sp} for `type="regular"` - Set `offset` as random for a random starting point. - Drop units of `l` necessary for `type="regular"`, otherwise units problem in `grp`. It may be necessary to add `@importFrom units drop_units` - If only a unique "size" is fixed, then sample will be regular over all. This means one point every x meter. I guess this is similar to `type = random` where not the same number of points are sampled on each line. Can maybe add some information about this in the doc.
R/sample.R
Outdated
message_longlat("st_sample") | ||
st_crs(x) = NA_crs_ | ||
} | ||
l = drop_units(st_length(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see travis output: drop_units is not found.
R/sample.R
Outdated
lcs = c(0, cumsum(l)) | ||
grp = split(d, cut(d, lcs, include.lowest = TRUE)) | ||
grp = lapply(seq_along(x), function(i) grp[[i]] - lcs[i]) | ||
st_sfc(CPL_gdal_linestring_sample(x, grp), crs = st_crs(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PR's in general, try to keep the source formatting, so that we can see what you actually changed.
It was not really easy to find where you call the
|
Thanks for the PR! Things should now have been merged; please test. |
Tested. It works ! |
That one is more tricky! Looking forward to a PR, |
Now available in branch |
This update for regular sample is only for lines.
type="regular"
offset
as random for a random starting point.l
necessary fortype="regular"
, otherwise units problem ingrp
.@importFrom units drop_units
type = random
where not the same number of points are sampled on each line.