Borrar filtros
Borrar filtros

Plot 3D Dome - no topo60c file available

13 visualizaciones (últimos 30 días)
Kurt
Kurt el 7 de Dic. de 2023
Movida: Cris LaPierre el 12 de Dic. de 2023
I am using the example of how to plot a dome as a mesh over a globe, found here:
It works great, however, I don't have access to the topo60c .mat file (I have looked, including the USGS site). topo60c is not anywhere in my matlabroot, or in the map toolbox examples or elsewhere on my system. So there is no surface texture, just a wire frame.
I found another Matlab example that converts a .jpg file to a .mat file, at this location:
With this, I was able to convert my 1024px-Land_ocean_ice_2048.jpg file to the equivalent .mat file (I think).
I modified the original sample code:
load topo60c
geoshow(topo60c,topo60cR,"DisplayType","texturemap")
to this:
load(image_mat)
geoshow(img_data,"DisplayType","texturemap")
where image_mat is the full path to my 1024px-Land_ocean_ice_2048.mat file.
However, when I try to run this code, I get an error message:
Function UPDATEGEOSTRUCT expected input number 1, S, to be a structure.
I can find the coastlines and rivers .mat data, and they load and display successfully.
When I compare the coastlines .mat file and my texturemap .mat file, I notice some differences. Opening coastlines.mat with Matlab, the Import Wizard reveals two structures:
Name Size Bytes Class
coastlat 9865x1 78920 double
coastlon 9865x1 78920 double
My texturemap file looks like this:
Name Size Bytes Class
img_data 1024x2048x3 6291456 uint8
img.data sure looks like a structure to me. What am I missing? Is the uint8 an issue?
I would rather use my texture map, since it is much higher resolution than topo60c.
  6 comentarios
Kurt
Kurt el 12 de Dic. de 2023
Movida: Cris LaPierre el 12 de Dic. de 2023
Thumb drives are not allowed either, but we can use CDs.
Jonah Weiss of Matlab found a solution to this problem:
Please replace these three lines:
load topo60c
geoshow(topo60c,topo60cR,"DisplayType","texturemap")
demcmap(topo60c)
with these lines:
% read the image
I = imread("1024px-Land_ocean_ice_2048.jpg");
% since the image is upside down, it needs to be flipped
I = flip(I);
% call geoshow with the image, specifying a reference of 2048/360 pixels per degree,
% a northern latitude limit of 90 degrees, and a western longitude limit of 180 degrees
geoshow(I, [2048/360 90 180]);
Cris LaPierre
Cris LaPierre el 12 de Dic. de 2023
Movida: Cris LaPierre el 12 de Dic. de 2023
As a longer-term solution, you could also ask your institution to install the documentation. This will give you access to the demo files locally.

Iniciar sesión para comentar.

Respuesta aceptada

Jonah
Jonah el 12 de Dic. de 2023
Kurt has already posted this solution in the comments, I am reposting as an answer so it is more visible.
To use the custom image 1024px-Land_ocean_ice_2048.jpg in the example https://www.mathworks.com/help/map/plotting-a-3-d-dome-as-a-mesh-over-a-globe.html,
replace these three lines:
load topo60c
geoshow(topo60c,topo60cR,"DisplayType","texturemap")
demcmap(topo60c)
with these lines:
% read the image
I = imread("1024px-Land_ocean_ice_2048.jpg");
% since the image is upside down, it needs to be flipped
I = flip(I);
% call geoshow with the image, specifying a reference of 2048/360 pixels per degree,
% a northern latitude limit of 90 degrees, and a western longitude limit of 180 degrees
geoshow(I, [2048/360 90 180]);

Más respuestas (0)

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by