psimage problem in plotting sunraster

Added by Kousik over 1 year ago

Hello GMT-users,
I am a newbie to GMT. My goal is to plot a Landsat tiff using GMT. I have read the steps on gmt-help. But I can not figure out how to plot a raster, which I got from a cropped Landsat geotiff (processed using gdal) after conversion using Imagemagick(convert roi.tif sun:roi.ras). I want to plot the raster with its lat/lon using psimage, the command I have used is

psimage roi.ras -JM6i -R-115.5/-114.8/35.8/36.5 -W6i -B0.1 -C0/0/BL -P -V > new.ps
psimage: Warning: -W option is deprecated; use -D modifier +w instead.
psimage: Warning: -C option is deprecated, use -Dx instead.
psimage: Processing input EPS or Sun rasterfile
PSL: Too many colors to make colormap - using 24-bit direct color instead.
PSL: DEFLATE compressed 21307456 to 13508667 bytes (36.6% savings at compression
level 5)

Actually I converted the projection from Mercator_1SP to lonlat using gdalwarp vegas.tif vegasp.tif -t_srs "+proj=longlat +ellps=WGS84" and cropped my region of interest using gdal_translate -a_ullr -115.5 36.5 -114.8 35.8 -projwin -115.5 36.5 -114.8 35.8 vegasp.tif roi.tif

The problem is the map border(pls see new.png), which is much larger the image. I am badly stuck on this problem. I'd appreciate if you help me to solve this problem. Thank you.

gdalinfo.txt Magnifier - gdalinfo of cropped image roi.tif (940 Bytes)

new.png - GMT output (547 KB)

gdalinfo_projected_image (956 Bytes)

gdalinfo_original_image (1.63 KB)


Replies (4)

RE: psimage problem in plotting sunraster - Added by Joaquim over 1 year ago

You can read GeoTIFFs directly with grdimage. See the doc for the -D option. The issue here might be with the projection system. Since we do not yet parse the proj4 string we cannot recognize the image's projection reference but it works if the image is in geogs. Here you might or not have to resort to use the -Dr -R combination. I suspect that grdimage -D is more powerful than we have documented but I would have to go check the code to be re-learn that.
Have a try with these hints.

RE: psimage problem in plotting sunraster - Added by Kousik over 1 year ago

Hi Joaquim,
Thank you for your quick reply. I used grdimage and it is working fine. Thank you so much for your help.

RE: psimage problem in plotting sunraster - Added by Nengfang 2 months ago

Hi Kousik,

Can you tell me how can you using grdimage to plot a Landsat tiff?
I failed.
Thank you very much!

RE: psimage problem in plotting sunraster - Added by Joaquim 2 months ago

Did you read my reply two posts above this?

(1-4/4)