Plotting an image in a geospatial domain given Lat and Lon information

조회 수: 7 (최근 30일)
Simone
Simone 2024년 7월 25일
댓글: Umar 2024년 7월 25일
Dear all,
After trying everything and more, it is time to give up and ask for your help.
I do have a matrix of Lat values, a matrix of Lon values, and a matrix of actual data. I need to display this in a geospatial domain, overlaying a Shapefile. Additionally, it is essential for me to add a scale bar. I have tried, geoshow, goeplot, mapshow, worldmap, and probably something else too, but every time there is something that goes wrong (i.e., Adding GeographicAxes to axes is not supported, etc.).
The best I achieved was:
close all
clc
figure
geoshow(LAT, LON, DATA, 'DisplayType', 'texturemap');
mapshow(SHP, 'FaceColor', 'none', 'EdgeColor', 'black', 'LineWidth', 1.5);
colormap gray
The problem with the code above is that nothing is georeferenced and, as such, it is impossible for me to add a scale bar.
Could you please help me make a nice georeferenced map?
Any help would be greatly appreciated.
I have attached the LAT, LON, DATA, and SHP.
Thanks a lot in advance
  댓글 수: 1
Umar
Umar 2024년 7월 25일
Hi Simone,
Unfortunately, I am not able to afford Mapping Toolbox required for geoshow. Here is the example code snippet to help you out.
% Load the provided data
load('LAT.mat');
load('LON.mat');
load('DATA.mat');
load('SHP.mat');
% Create a new figure for the map
figure;
% Display the geospatial data with proper georeferencing
geoshow(DATA, [LAT(1) LAT(end)], [LON(1) LON(end)], 'DisplayType', 'texturemap');
% Overlay the Shapefile with specified properties
mapshow(SHP, 'FaceColor', 'none', 'EdgeColor', 'black', 'LineWidth', 1.5);
% Add a scale bar to the map
scalebar;
% Customize the colormap for better visualization
colormap gray;
% Add a title to the map
title('Georeferenced Map with Scale Bar');
% Display a colorbar for reference
colorbar;
If you follow my mentioned steps, it will help resolve your issue. You already know how to load the provided Latitude, Longitude, data, and Shapefile matrices into the workspace. Then, create a new figure to display the georeferenced map. The geoshow function is used to display the actual data on the map with proper georeferencing based on the provided Latitude and Longitude ranges, for
For more information on this function, please refer to
https://www.mathworks.com/help/map/ref/geoshow.html?s_tid=doc_ta
use the mapshow function to overlay the Shapefile on the map with specified visual properties like EdgeColor and LineWidth. For more information on this function, please refer to
https://www.mathworks.com/help/map/ref/mapshow.html
Then, adds a scale bar to the map for reference by using scale bar function,the colormap is used set to grayscale for better visualization of the data , for more information on this function, please refer to
https://www.mathworks.com/help/matlab/ref/colormap.html?s_tid=doc_ta
then add a title to the map for identification, and you will see a colorbar displayed to indicate the data range. Hope, this should help resolve your problem and answers your question.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by