Change opacity of basemap using mapping toolbox?

I have a map with data plotted over it, but the satellite map makes reading the data somewhat confusing (must use a satellite background 'strees-light' does not work). Is there a way to change the opacity of the background basemap or at least hange the saturation? I'm using geoplot to plot my values using the built-in 'satellite' basemap.

 Accepted Answer

I bet there's some better way to do this, but I didn't see one. Take that with a grain of salt. I never really use mapping toolbox stuff, and geoaxes are new to me.
This relies on editing undocumented properties of the geoaxes' descendant objects. The settings will be volatile, so if you zoom/pan the axes, it gets reset. I'm not sure of the best way to work around that. This whole example may be entirely impractical otherwise. Maybe someone knows a better way, or at least knows of an appropriate way to set up a listener for changes to a geoaxes object.
geobasemap('satellite')
hax = findobj(gcf,'type','geoaxes');
opacity = 0.3;
% this part needs to be run whenever the axes gets updated
% so either manually run it as needed or put it in a callback function
drawnow
tstrips = vertcat(hax.BasemapDisplay.QuadObjects.Children);
for k = 1:numel(tstrips)
mapcd = tstrips(k).TriangleStrip.Texture.CData;
mapcd = opacity*(1-im2double(mapcd));
mapcd = im2uint8(1-mapcd);
tstrips(k).TriangleStrip.Texture.CData = mapcd;
end
Then again, maybe this doesn't work at all in newer versions.

2 Comments

Thank you! This works perfectly until I need to save the figure, which comes with the territory I guess of needing to be run everytime the axes update. Unfortunate they don't have a better way to do this given the normal plot function has so much customization.
The other thought was to put a semi-opaque white patch object underneath anything that's plotted above it. The problem there is that patch() objects can't be placed in a geoaxes, and even if you could, it would be atop (and therefore obscure) the grid. I'm not sure how to get objects stacked beneath the grid.
It seems that the suggested workaround for patch objects is to use an overlaid axes object, which completely defeats the point of using it to subdue the basemap in the geoaxes.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2022b

Asked:

on 30 Jun 2023

Commented:

DGM
on 3 Jul 2023

Community Treasure Hunt

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

Start Hunting!