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

Cannot find how to change the CRS of a GEOS geometry #81

Open
oliviermeslin opened this issue Jan 12, 2023 · 3 comments
Open

Cannot find how to change the CRS of a GEOS geometry #81

oliviermeslin opened this issue Jan 12, 2023 · 3 comments

Comments

@oliviermeslin
Copy link

oliviermeslin commented Jan 12, 2023

Hi, I'm looking for the GEOS equivalent of sf::st_transform, because I want to change the CRS of a GEOS geometry in the package (from 2154 to 4326). I looked carefully in the list of functions but couldn't find it. Am I missing or misunderstanding something?

Thanks for developing this very useful package, it really helped me in my current project (along with wk and ggspatial)!

@paleolimbot
Copy link
Owner

You're welcome!

GEOS doesn't do coordinate transformations...you will need sf to do that for you because it contains a copy of GDAL and PROJ which provide the infrastructure for that. I had some early experiments to provide that infrastructure in a lighter way; however, none of them made it to CRAN. sf::st_transform() is your best bet for now! See also sf::sf_project() which is a lighter version that works better for points.

@oliviermeslin
Copy link
Author

Thanks a lot for your very fast answer!

@mdsumner
Copy link
Contributor

mdsumner commented Apr 27, 2023

do we have a generalized round-trip, though? sfheaders had the beginning of something like

df <- sf_to_df(x)
df <- <do something here, like sf::project(df[c("x", "y")], to = <target>, from = wk::wk_crs(x))>
x <- df_restore_what_x_was(df)

that would be so sweet, and enable a whole lot of workflows now that wk handles so many types. This is just a OTOH thought, I'll actually have a look into it (it's not too hard, and could have a syntax like wk_coords(x) <- do_stuff(wk_coords(x), args...).

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

No branches or pull requests

3 participants