-
Notifications
You must be signed in to change notification settings - Fork 18
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
Comments
Nice. Then rasters can extend that method too. It should work on any geometry but return a GI geometry. |
I have it as |
I like |
IMO |
I guess if we went down this road we might want to introduce:
|
I'm ok with |
|
Does setcrs need to be defined for all types i.e.:
or is there a clever way to automate this? |
Here's a brief prototype that we can override for known types: import GeoInterface as GI
setcrs(x, crs) = setcrs(GI.trait(x), x, crs)
function setcrs(trait::Nothing, x, crs)
error("Trait not found for $(typeof(x))")
# or, use GeometryOpsCore at the top level
end
function setcrs(trait::GI.AbstractGeometryTrait, x, crs)
return GI.Wrappers.geointerface_geomtype(trait)(x; crs)
end
# then, usage is
import LibGEOS as LG
p = LG.Point([1., 2.])
setcrs(p, "EPSG:4326")
|
We can then dispatch on the type of |
@asinghvi17 are you planning to open a PR for the above? |
This is a one liner with Possibly |
I'm hesitant to make this a GeoInterface (1.x) thing that we can't break. With setcrs you can expect one of two behaviours, purely set the crs, or actually transform from the current one to the new one. That said this seems more a feature request on wrapping a crs for GeoInterface.Wrappers, not a general functionality. Geopandas seems to have to_crs for the transform and set_crs for this proposal here. |
So do we just need to check if a |
That sounds like a good idea |
Maybe with a kwarg |
A simple setcrs utility would be a nice to have. Doing this:
is a bit awkward. a setcrs utility
would help clean things up
The text was updated successfully, but these errors were encountered: