-
Notifications
You must be signed in to change notification settings - Fork 25
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
Integrate better with GeoInterface.jl and Proj.jl to plot any geoms in any projections #161
Comments
hmm, that sounds hard to implement if it's the object which has the projection, since we can't really dispatch on that... |
We can dispatch on So it would need specialisation fot those methods on Then we can use Proj.jl to reproject the geometries to the axis projection. Its quite easily doable ;) |
We can do that...but I don't think Makie can. Maybe in the poly recipe, using a convert to a geointerface wrapper or custom wrapper type? But not generally. |
Wouldn't that also be a use case for the CRS trait discussed in JuliaGeo/GeoInterface.jl#119 ? |
This is a bit orthogonal - the problem lies in extracting the CRS, not in dispatching on it. That's already implemented in the code anyway. |
What is the problem extracting it exactly? |
The question, I guess, was where to perform the extraction - but I guess it's actually possible to do this in the same place we |
Lines 817 to 830 in 8941fe9
source would also have to check |
Ahh no it will already be gone right? Converted to GeometryBasics with no crs? Or is the original object still around? |
The original object should still be around in |
Ok cool, I've no idea how it works internally |
You should be able to call Mixed crs can be undefined 😂 |
Yeah that's what I was thinking as well :D |
Here's what I'm thinking: get_crs(obj) = get_crs(GI.trait(obj), obj)
get_crs(::GI.AbstractGeometryTrait, obj) = GI.crs(obj)
function get_crs(::Nothing, obj)
if obj isa AbstractVector
if GI.trait(first(obj)) isa GI.AbstractGeometryTrait
return get_crs_vector_checked(obj)
end
end
return GI.crs(obj)
end
function get_crs_vector_checked(obj)
crs_es = GI.crs.(obj)
if length(unique(crs_es)) == 1
return first(crs_es)
else
@warn("You have tried to plot objects with conflicting CRS in the same plot call! Assuming `crs=nothing` for now.")
return nothing
end
end |
It turned out that this caused some form of infinite loop, I'm still not sure why. Will keep looking. |
GeoMakie.jl could accept any geointerface geometries in any projection.
Some geometries have the projection attached already, so we could do the conversion automaticaly. Otherwise plotting onto a GeoAxis could accept a
source_crs
keyword and do the conversions.If the geometries are in different projections to the map and/or each other we can reproject them with JuliaGeo/Proj.jl#79
The text was updated successfully, but these errors were encountered: