Located at: /home/kristof/.local/share/proj:/usr/share/proj:/usr/share/proj
but first error message said it was trying another libproj.so
Located at: /home/kristof/.local/share/proj:/usr/share/proj:/usr/share/proj
but first error message said it was trying another libproj.so
Maybe the whole output is helpful to you?
> julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.1 (2021-04-23)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> using GMT
julia> imshow(buffergeo([0 0; 5 5], width=100, unit=:k))
ERROR: could not load symbol "pj_get_spheroid_defn":
/usr/bin/../lib/libproj.so.22: undefined symbol: pj_get_spheroid_defn
Stacktrace:
[1] pj_get_spheroid_defn
@ ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:416 [inlined]
[2] get_ellipsoid(projPJ_ptr::Ptr{Nothing})
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:390
[3] invgeod(lonlat1::Matrix{Int64}, lonlat2::Matrix{Int64}; proj::String, s_srs::String, epsg::Int64)
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:126
[4] buffergeo(line::Matrix{Int64}; width::Int64, unit::Symbol, np::Int64, flatstart::Bool, flatend::Bool, proj::String, epsg::Int64, tol::Float64)
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:241
[5] top-level scope
@ REPL[2]:1
julia> GMT.proj_info()
Rel. 8.0.1, March 5th, 2021
Located at: /home/kristof/.local/share/proj:/usr/share/proj:/usr/share/proj
julia>
I must admit I’m way outside my comfort zone here.
And me? I’m all Windows. Unix makes me terrible headaches.
What I can infer is that you have multiple proj libraries and one of them is giving troubles and we don’t know which version it is (the /usr/bin/../lib/libproj.so.22)
There is another alternative that personally hate but maybe it can save you. If you set the env variable FORCE_INSTALL_GMT="whatever" it will install you a Conda GMT+GDAL that hopefully may resolve your library conflicts. This GMT version will be whatever Conda serves you. I tested this in CI (Ubuntu 2020 and Mac) and it worked but also had a CentosOS8 where lib shits have occured.
Note, you must set the env variable before starting Julia and likely will have to run
GMT.force_precompile(), to force a pre-compilation where the Conda install will be detected, and possibly restart Julia again.
(I told you I don’t like this)
And, BTW, is your GDAL as seen from Julia the same as seen from the shell (no path info here, pity)?
julia> GMT.Gdal.GDALVersionInfo("--version")
vs
gdalinfo --version
PROJ seems to be the same from the shell:
~/Dokumente/GMTjl > proj
Rel. 8.0.1, March 5th, 2021
usage: proj [-bdeEfiIlmorsStTvVwW [args]] [+opt[=arg] ...] [file ...]
~/Dokumente/GMTjl > which proj
/usr/bin/proj
GDAL as well:
julia> GMT.Gdal.GDALVersionInfo("--version")
"GDAL 3.2.3, released 2021/04/27"
julia> exit()
~/Dokumente/GMTjl > gdalinfo --version
GDAL 3.2.3, released 2021/04/27
~/Dokumente/GMTjl > which gdalinfo
/usr/bin/gdalinfo
I forgot about you being a Windows user. My apologies. I learnt you prefer wine over beer. Next time I send a wine glass your way …
Not that I have any insight on this, but would not the whole geo buffering be more useful to everybody if it was implemented in the API instead of a wrapper?
I agree with you @pwessel this would be great to have directly in the API (and an advantage of GMT over the commercialy available GIS software). And even more off-topic … shameless plug: That texture shading thing discussed here in the forum and on GitHub would be a great addition as well. 
Yes it would but I have no clear idea on the work it would take to try to write it in C and for sure it would take 10x longer for me to implement it in C.
And does the buffer works for you? You have proj8 if I remember well.
I assume you are asking Paul?
Sorry, did not hear you as I was deep in the C basement dealing with bugs. Somebody gotta be down there you know.
Not ready to do that sort of testing for y’all.
OK, I found it. pj_get_spheroid_defn is part of the old PROJ4 API that was dropped in version 8 (ghrrr!). I’ll have to find out how to do the same with the new API.
@KristofKoch please update (master) and try again. I’ve not tested it myself because I’ve not yet a proj4 v8 but at least that pj_get_spheroid_defn function is not used anymore.
Is there anything I need to do inside Julia after updating GMT?
Currently no luck:
julia> imshow(buffergeo([0 0; 5 5], width=100, unit=:k))
ERROR: could not load symbol "pj_get_spheroid_defn":
/usr/bin/../lib/libproj.so.22: undefined symbol: pj_get_spheroid_defn
Stacktrace:
[1] pj_get_spheroid_defn
@ ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:416 [inlined]
[2] get_ellipsoid(projPJ_ptr::Ptr{Nothing})
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:390
[3] invgeod(lonlat1::Matrix{Int64}, lonlat2::Matrix{Int64}; proj::String, s_srs::String, epsg::Int64)
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:126
[4] buffergeo(line::Matrix{Int64}; width::Int64, unit::Symbol, np::Int64, flatstart::Bool, flatend::Bool, proj::String, epsg::Int64, tol::Float64)
@ GMT ~/.julia/packages/GMT/Ixkua/src/proj_utils.jl:241
[5] top-level scope
@ REPL[12]:1
EDIT: gmt --version 6.3.0_b204909_2021.06.09
What you have to update is the wrapper, not GMT. You do that with (type it in Julia)
] up
but this assumes you are in the GMT.jl master version. If you are not, do
] add GMT#master
next updates will update the master version.
Ah, that’s the thing I didn’t do correctly. Thank you for your explanation, @joaquim. I’m still new to Julia. I tried to use geobuffer! to append to the previous coast call. But all I get is another error message:
> julia worldsnake.jl
ERROR: LoadError: UndefVarError: buffergeo! not defined
Stacktrace:
[1] top-level scope
@ ~/Dokumente/GMTjl/worldsnake.jl:4
in expression starting at /home/kristof/Dokumente/GMTjl/worldsnake.jl:4
What am I screwing up this time?
Some code to play with:
Content of worldsnake.jl:
using GMT
coast(region=:g, proj=(name=:ortho, center=(-75,41)), frame=:g, res=:crude, area=5000, land=:pink, ocean=:thistle, figsize=10)
buffergeo!("worldsnake.txt", width=100, unit=:Nautical, show=true)
Contents of worldsnake.txt:
-80 -30
-90 0
-30 20
-5 40
-30 60
30 70
180 75
-30 70
5 50
30 20
90 0
80 -30
Ok, some more quick Julia wrapper infos.
It’s a convention in Julia that functions ending with an exclamation mark ! modify their input arguments. This convention was extending to plots where using a ! means we are adding to a plot. Exactly like the classic -K -O and that is why one can mimic most of the modern mode scripts (except subplot and a couple of other modern-only) by using the ! notation.
But buffergeo is not a plotting module (type ? buffergeo to see the online help) so it doesn’t have a buffergeo! brother. It computes the buffer that one later plot using plot, or one of its psxy|z avatars.
So
using GMT
# Instead of a file we may use a matrix
worldsnake = [-80 -30; -90 0; -30 20; -5 40; -30 60; 30 70; 180 75; -30 70; 5 50; 30 20; 90 0; 80 -30];
# Compute the buffer
D = buffergeo(worldsnake, width=100, unit=:n); # As you wish, :Nautical or :n is the same (only first char matters but this may change)
# res (-D) is set automatically
coast(region=:g, proj=(name=:ortho, center=(-75,41)), frame=:g, area=5000, land=:pink, ocean=:thistle)
# Append the buffer. Now we need to use ``plot!`` because we are appending (no worries about closing the PS file. That is also done automatically when a ``show`` or file save is invoked.
plot!(D, fill=:green, show=true)
As you can see , there is still a small issue at the dateline. It’s not an easy matter, it caused me a lot of troubles with the polygon union function.
and since I’m a one-liner maniac, this produces the same plot
coast(region=:g, proj=(name=:ortho, center=(-75,41)), frame=:g, area=5000, land=:pink, ocean=:thistle, plot=(data=D, fill=:green), show=true)`
@KristofKoch you may be also interested in the orthodroms. See this (geodesic loxodromes also available)
Hi @joaquim that primer on the Julia wrapper was sorely needed. Thank you! I learnt a lot with your post. Great to have not only orthodromes (my usual go to) but also loxodromes. To see what happens at the datum line was the intent of that example.
Again, awesome to have that capability. Thank you!