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

feature request: setcrs #158

Open
alex-s-gardner opened this issue Sep 20, 2024 · 7 comments
Open

feature request: setcrs #158

alex-s-gardner opened this issue Sep 20, 2024 · 7 comments

Comments

@alex-s-gardner
Copy link
Contributor

A simple setcrs utility would be a nice to have. Doing this:

GI.MultiPolygon.(multipoly, crs=GFT.EPSG[3413])
GI.Polygon.(poly, crs=GFT.EPSG[3413])

is a bit awkward. a setcrs utility

GI.setcrs(multipoly, GFT.EPSG[3413])
GI.setcrs(poly, GFT.EPSG[3413])

would help clean things up

@rafaqz
Copy link
Member

rafaqz commented Sep 20, 2024

Nice. Then rasters can extend that method too.

It should work on any geometry but return a GI geometry.

@evetion
Copy link
Member

evetion commented Sep 20, 2024

I have it as crs! in GeoArrays, which is more Julian? But yeah, would be good to have as a common definition (like read/write). Not sure about it always wrapping if the object doesn't implement it.

@alex-s-gardner
Copy link
Contributor Author

I like crs or crs! if it doesn't reallocate

@asinghvi17
Copy link
Member

asinghvi17 commented Sep 20, 2024

IMO crs!(x) only makes sense if x is mutable and can change its CRS, which is not the case for LibGEOS, Shapefile, GeoJSON, WKB, all other Julia reader geometries, and GI wrappers (I'm probably missing a few here). crs is also used as a getter so I'd tend to prefer setcrs (and maybe optional setcrs! for e.g. ArchGDAL and GeoDataFrames / Tables in general).

@alex-s-gardner
Copy link
Contributor Author

I guess if we went down this road we might want to introduce:

GI.getcrs and then phase out GI.crs

@rafaqz
Copy link
Member

rafaqz commented Sep 22, 2024

I'm ok with crs and setcrs. That's what Rasters always had

@rafaqz
Copy link
Member

rafaqz commented Sep 22, 2024

setcrs can have the fallback of just wrapping with GI geoms for when the original object can't hold crs

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

4 participants