sorry I am a GMT newbie and struggling with my very first experiments with grdview.
I am trying to drape an image (a PNG file, but tested it with JPG too) on earth relief.
But I am getting - after some warnings I do not understand - a segmentation fault using GMT 6.3.0 under Ubuntu (22.04.02 LTS).
Insights appreciated !!
Regards, Ity
Code:
indent preformatted text by 4 spaces
#!/usr/bin/bash
# Region
minlon=8.3
maxlon=9.2
minlat=51.5
maxlat=52
minheight=0
maxheight=500
# Map resolution
resolution=01m
# Overlay
overlay_inbound_file=overlay2.png
gmt begin region png
gmt grdview @earth_relief_${resolution} -G${overlay_inbound_file} -R${minlon}/${maxlon}/${minlat}/${maxlat}/${minheight}/${maxheight} -Qi
gmt end
Output:
$ ./min.sh
grdview [WARNING]: (w - x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.
grdview [WARNING]: w reset from 8.3 to 7
grdview [WARNING]: (e - x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.
grdview [WARNING]: e reset from 9.2 to 10
grdview [WARNING]: (s - y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.
grdview [WARNING]: s reset from 51.5 to 51
ERROR: Caught signal number 11 (Segmentation fault) at
/lib/x86_64-linux-gnu/libgmt.so.6(gmt_gdalread+0x245a)[0x7f9ccccb4c1a]
[0x55d6cb801001]
malloc_consolidate(): invalid chunk size
./min.sh: line 19: 142084 Aborted gmt grdview @earth_relief_${resolution} -G${overlay_inbound_file} -R${minlon}/${maxlon}/${minlat}/${maxlat}/${minheight}/${maxheight} -Qi
Regarding the segmentation fault:
Both test files atteched, the PNG and the JPG. Both of them random pictures w/o any useful content… Useful for first steps only.
Unclear. Your blue blob JPG is a 3000x3000 image while your desired geographic area -R8.3/9.2/51.5/52 is 55x31. I found also that the crash was due to the “jpeg” extension which GMT did not check for. I will fix that.
You specify no vertical scale and no vantage point. If I add those and a frame I get something like the below image. Your white pixels buries the topography since it is white, not NaNs or transparent pixels. I think your challenges are
How to relate your square image (which has a map frame and white margins that I do not know if you want to plot inside a geographic map)
For now, use .jpg until we fix that in 6.5
Add some vertical scaling and vantage point. Draping makes no sense unless you do.
Have transparent pixels (will that work, @Joaquim ?)
Even with that line I get a seg-fault, might be a problem with Ubuntus GMT 6.3.0 package then (which I use within WSL2 under Win11). Next step for me will be to check how to update to 6.4.
(and yes, then I have some todos learning howo to tackle scaling/vantage/…)
Thanks ! Regards, ity
gmt grdview @earth_relief_01m -Goverlay.jpg -R8.3/9.2/51.5/52/0/500 -Qi -JZ2i -p135/35 -B -png map
grdview [WARNING]: (w - x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.
grdview [WARNING]: w reset from 8.3 to 7
grdview [WARNING]: (e - x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.
grdview [WARNING]: e reset from 9.2 to 10
grdview [WARNING]: (s - y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.
grdview [WARNING]: s reset from 51.5 to 51
ERROR: Caught signal number 11 (Segmentation fault) at
/lib/x86_64-linux-gnu/libgmt.so.6(gmt_gdalread+0x245a)[0x7f382cf3dc1a]
[0x55be69151000]
malloc_consolidate(): invalid chunk size
Aborted
Most likely 6.3 problem, but note I am running the master build from GitHub (i.e., proto 6.5) and not 6.4 so who knows when this was fixed or if it is something else.
Thanks a lot so far! And thanks for checking on macOS too!
(getting 6.5-dev up and running on my system is a little to ambitous for a rookie like me… Will have to wait then. But there is a lot of other stuff to explore with GMT!