Plot 3D Dome - no topo60c file available

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 Comments

After looking at the topo60c.mat file, I can see why my 1024px-Land_ocean_ice_2048.mat file is not working. Here is the structure of topo60c:
Name Size Bytes Class
description 1x1 342 string
topo60c 180x360 518400 double
topo60cR 1x1 128 map.rastereff.GeographicCellsReference
Apparently that .mat conversion routine is not doing a very good job of converting to what I need.
I have seen examples where a regular .jpg file is used as texture, but those are for geographic displays, which are a whole different methodology.
You need to open the example locally in order to have access to the mat file. Use the following command:
openExample('map/mapex3ddome')
Kurt
Kurt on 11 Dec 2023
Moved: Cris LaPierre on 12 Dec 2023
Unfortunately this particular development computer is not on the internet. I should have clarified that.
Can you save the file to a thumbdrive on a computer that is on the internet?
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]);
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.

Sign in to comment.

 Accepted Answer

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]);

More Answers (0)

Products

Release

R2023a

Asked:

on 7 Dec 2023

Moved:

on 12 Dec 2023

Community Treasure Hunt

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

Start Hunting!