geodensityplot of CONUS, Alaska, and Hawaii

4 views (last 30 days)
I am trying to create a geographical heat map aka geodensityplot with lattitude and longitude data and concentrations of metals imported from an excel file. I want to only show the continental united states with Alaska and Hawaii below.
How do I show those areas after creating the geodensityplot?
%% Import Excel sheet and assign variables to the column vectors.
% accomplished with ImportExcelMappingData.m
%% Map the USA including Alaska and Hawaii
% First create geodensity plot ie heatmap of mineral: Lithium
radiusInMeters = 50e3; % 50 km
dp = geodensityplot(LATITUDE,LONGITUDE,Li,'RadiusMode', 'manual', 'Radius',radiusInMeters, "FaceColor", 'interp');
colormap hot;
colorbar;
% Need to now take that generated geodensity plot and only show CONUS,
% Alaska and Hawaii
% I AM STUCK ON THIS PART!
% Read a shapefile, containing polygon shapes for each of the US states and the District of Columbia, into a geospatial table. Find the table rows for the conterminous USA, Alaska, and Hawaii.
states = readgeotable("usastatelo.shp");
rowConus = states.Name ~= "Hawaii" & states.Name ~= "Alaska";
rowAlaska = states.Name == "Alaska";
rowHawaii = states.Name == "Hawaii";
% Display each of the three regions on separate axes.
figure
ax = usamap('all');
set(ax,"Visible","off");
geoshow(ax(1),states(rowConus,:));
geoshow(ax(2),states(rowAlaska,:));
geoshow(ax(3),states(rowHawaii,:));
% Hide the frame
for k = 1:3
setm(ax(k),"Frame","off","Grid","off",...
"ParallelLabel","off","MeridianLabel","off");
showm(dp)
end
geoaxes(ax); % makes the Geographic axes object gx the current axes
basemap = geobasemap(ax); returns the basemap value for the geographic axes or chart specified by gx.
geobasemap(basemap) % sets the basemap of the current geographic axes or chart to the value specified by basemap.
% getm(gca,'MapProjection')

Accepted Answer

Yash
Yash on 13 Oct 2023
Hi Daniel Moran,
I understand that you want to plot concentrations of metals with latitude and longitude data but only want to show continental US with Hawaii and Alaska. I am assuming that LATITUDE, LONGITUDE and Li are Nx1 arrays. Refer to the code below:
states = readgeotable("usastatelo.shp");
rowConus = states.Name ~= "Hawaii" & states.Name ~= "Alaska";
rowAlaska = states.Name == "Alaska";
rowHawaii = states.Name == "Hawaii";
% Display each of the three regions on separate axes.
figure
ax = usamap('all');
set(ax,"Visible","off");
geoshow(ax(1),states(rowConus,:));
geoshow(ax(2),states(rowAlaska,:));
geoshow(ax(3),states(rowHawaii,:));
% Hide the frame
for k = 1:3
setm(ax(k),"Frame","off","Grid","off",...
"ParallelLabel","off","MeridianLabel","off");
end
for i = 1:numel(Li)
geoshow(LATITUDE(i), LONGITUDE(i), 'DisplayType', 'point', 'Marker', 'o', 'MarkerFaceColor', 'red', 'MarkerSize', Li(i));
end
Refer to the following resources for discussion on plotting heatmap onto an existing mapping:
I hope this helps!

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!