Dear all,
I am new in (Py)GMT. I am trying to drape a Landsat8 RGB composite over the SRTM DEM.
My Landsat8 composite RGB image is a GeoTIFF file. To start simple, however, I am trying with a single band.
In a Jupyter notebook, I do:
geographic_coordinates = {
'west': -4.17272200,
'north': 40.80833333,
'east': -3.03544243,
'south': 40.00833333,
}
gmt_coordinates=[
geographic_coordinates['west'],
geographic_coordinates['east'],
geographic_coordinates['south'],
geographic_coordinates['north'],
]
region = {
'geographic': geographic_coordinates,
'gmt': gmt_coordinates,
}
Get the relief
grid = pygmt.datasets.load_earth_relief(
resolution="01m",
region=region['gmt'],
use_srtm=True,
)
and confirming it is what expected
fig = pygmt.Figure()
fig.grdview(
grid=grid,
# Set the azimuth to -130 (230) degrees and the elevation to 30 degrees
perspective=[180, 90],
frame=["xaf", "yaf", "WSnE"],
projection="M15c",
zsize="1.5c",
surftype="s",
cmap="geo",
plane="1000+ggrey",
# Set the contour pen thickness to "0.1p"
contourpen="0.2p",
)
fig.show()
So far so good. How can I use a GeoTIFF file (say a single band to start with) with
fig.grdimage()
? The following image is referenced in geographic coordinates (epsg:4326). Something like the following will crash the running (Jupyter) kernel, everytime.
fig.grdimage(grid=grid, img_in='madrid_landsat8_reflectance_5_2019_07_02T10_55_29_wgs84.tif')
I read the documentation and similar examples. For example https://docs.generic-mapping-tools.org/6.2/gallery/ex32.html where the image in question is converted to an nc
format or this Q&A how-to-plot-satellite-optical-image-of-geotif-format-and-show-the-true-color and similar ones. I understand that I have to read-in or convert somehow the GeoTIFF image in some other format, like .ps
(=Postscript?) or .nc
.
I’d appreciate some help. Kindest regards, Nikos