Closed evetion closed 1 year ago
We can also create a new struct, such as Pipeline
?
I'd prefer to support this as part of the Proj.Transformation
API. It secretly already works:
julia> using Proj
julia> pipe = Proj.proj_create("+proj=pipeline +step +proj=unitconvert +xy_in=deg +z_in=m +xy_out=rad +z_out=m +step +inv +proj=longlat +a=6378136.3 +rf=298.257 +e=0.08181922146 +step +proj=cart +a=6378136.3 +rf=298.257 +step +inv +proj=cart +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +z_in=m +xy_out=deg +z_out=m +step +proj=axisswap +order=2,1")
Ptr{Nothing} @0x0000000066f7aee0
julia> trans = Proj.Transformation(pipe, PJ_FWD);
julia> trans(0, 0, 0)
(0.0, 0.0, -0.7000000001862645)
Though that hides the rough edges, since some of the code, like, show
don't work:
julia> trans = Proj.Transformation(pipe, PJ_FWD)
Error showing value of type Proj.Transformation:
ERROR: ArgumentError: cannot convert NULL to string
Stacktrace:
[1] unsafe_string
@ .\strings\string.jl:70 [inlined]
[2] unsafe_string
@ .\c.jl:193 [inlined]
[3] show(io::IOContext{Base.TTY}, trans::Proj.Transformation)
@ Proj D:\visser_mn\.julia\dev\Proj\src\coord.jl:104
And we'd probably want a constructor that takes a single string, rather than passing the pointer to the pipeline created by proj_create
.
Now to setup a pipeline, we need to handle the C API: