-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Create linestring without Z or M dimension #86
Comments
Your example doesn't have Or are you referring to the |
Hi! I could have written the questions much better, but I was referring to the fact that the output object has a
I'm not 100% sure but, after reading that GH issue, I think that I could simply remove the |
Yes that should still work for you attr( fake_linestring, "z_range" ) <- NULL
attr( fake_linestring, "m_range" ) <- NULL
fake_linestring
# Geometry set for 2 features
# geometry type: LINESTRING
# dimension: XY
# bbox: xmin: -2.772747 ymin: -1.044071 xmax: 2.672171 ymax: 1.966581
# CRS: NA
# LINESTRING (0.4554192 -0.05182977, -0.35838 1.9...
# LINESTRING (0.5933351 0.5489179, 0.8940883 -0.5... But may I ask why you don't want those attributes? Perhaps we could consider only adding them as attributes ONLY IF the Z and / or M dimensions exist. ping @edzer - do you have any thoughts on updating the |
Isn't that the case right now?
|
oh yeah - you're absolutely right - thanks for clarifying. Then I think, @agila5, I need to udpate |
@agila5 in the development version you should now see this behaviour remotes::install_github("dcooley/sfheaders")
library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(sfheaders)
# create data
fake_data <- data.frame(
x = rnorm(10),
y = rnorm(10),
ID = rep(c("A", "B"), each = 5)
)
# fake_linestring <- sfc_linestring(fake_data, linestring_id = "ID")
# fake_linestring
# Geometry set for 2 features
# geometry type: LINESTRING
# dimension: XY
# bbox: xmin: -2.67091 ymin: -2.172776 xmax: 1.768129 ymax: 2.043167
# CRS: NA
# LINESTRING (-2.67091 -2.172776, 1.768129 0.4822...
# LINESTRING (1.11033 -0.9021552, 0.766239 0.2187... |
Thank you very much, it works perfectly.
I created an algorithm to modify LINESTRING data obtained from Open Street Map (see here if you want to read more details) and it didn't feel natural to return an XY object with missing Z/M range that will always be missing since the input data doesn't have Z or M dimensions. |
I see there's a lot going on in there! If it helps in any way you might find |
Thanks for the suggestions! That's only the first draft for the new function, I hope I will revise it in a few days since |
Hi! First of all, thank you very much for working on this package, it's extremely useful.
I created this github issue since I have a question related to
sfc_linestring
function. Is it possible to define a new object without Z or M dimensions? For example:Created on 2020-11-13 by the reprex package (v0.3.0)
I know that I can use
st_zm
after creating the object, but I would like to skip that step if possible. Thanks!The text was updated successfully, but these errors were encountered: