How can i plot a number of cities onto a DEM?

1 Ansicht (letzte 30 Tage)
Epiphanie IMANIMFASHE
Epiphanie IMANIMFASHE am 7 Jun. 2021
Beantwortet: Balavignesh am 11 Okt. 2023
I have a question in matlab, I want to plot the Cities in a DEM . So to plot the cities I am using geoshow, to show the DEM i am using mapshow,
None of these functions can display both cities and DEM alone.
Also when I want to superimpose them by using 'hold on' function, in order that all of them can be visible , so it is not working. I need some help if you have an idea about it please.

Antworten (1)

Balavignesh
Balavignesh am 11 Okt. 2023
Hi Epiphanie,
As per my understanding, you would like to plot the citites onto a 'Digital Elevation Model (DEM)'.
I assume you would have the dataset of the cities and the elevation matrix. I would suggest you to use the 'imagesc' function to display the elevation data, 'geoshow' function to plot the cities, and 'hold' function to superimpose the cities onto DEM.
The following example code may help you understand this:
% This is an example dataset.
Z = [100 200 300;400 500 600;700 800 900];
% Display the elevation data
imagesc(Z);
colorbar;
% Hold to superimpose the cities
hold on;
% Sample city locations
cities = [0.5 0.8;1.2 1.5;2.0 0.7];
% Display the city locations onto DEM
geoshow(cities(:, 2), cities(:, 1), 'Marker','o', 'MarkerSize', 10, 'MarkerFaceColor', 'red');
% Customize the plot as desired
xlabel('Longitude');
ylabel('Latitude');
title('Cities on Elevation Model');
% Release the hold
hold off;
Kindly have a look at the below documentation links to have more information on:
Hope that helps!
Balavignesh

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by