Skip to content
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

crs is lost in st_as_sfc.bbox #2330

Closed
wants to merge 1 commit into from
Closed

Conversation

faridcher
Copy link
Contributor

st_as_sfc(st_bbox(st_linestring(matrix(1:4,2))), crs=4326)

@edzer
Copy link
Member

edzer commented Feb 6, 2024

Yes, but what if argument crs is different from the CRS of x? Why not use

st_as_sfc(st_set_crs(st_bbox(st_linestring(matrix(1:4,2))), 4326))

@faridcher
Copy link
Contributor Author

faridcher commented Feb 8, 2024

i think st_set_crs is too verbose and redundant. Why not just use st_as_sfc?
As a side note, I think st_bbox(obj, ..., crs) should support objects other than Extent and numeric so st_bbox(st_linestring(matrix(1:4,2)), crs=4326) would work then.

@edzer
Copy link
Member

edzer commented Feb 8, 2024

You did not answer my first question.

@faridcher
Copy link
Contributor Author

faridcher commented Feb 8, 2024

You are right. I wrote this patch when st_bbox did not support crs. st_set_crs works here but my above side note
still applies and makes st_bbox more flexible. thank you

@faridcher faridcher closed this Feb 8, 2024
@faridcher faridcher deleted the patch-6 branch February 8, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants