Effacer les filtres
Effacer les filtres

Placing Image on GeographicAxes

19 vues (au cours des 30 derniers jours)
Kevin Hickman
Kevin Hickman le 27 Fév 2023
I have a map showing boat routes with other various data, and would like to place the top down images of ships on the different routes for the visuals/animations. The problem mainly seems to be coming from the fact the maps are on GeographicAxes. Even a shapefile to show the silhouette of the ships would be fine, but I'm really struggling to make this work, and I'm not finding any examples that would help.
I suppose this is the closest one (Cropped Image Example), but I believe a more straightforward solution exists. I simply need to drop a cropped silhouette on a Lat/Lon (or I think I can figure out a pixel position if it needs to be turned into a picture first), and then rotated to have the proper orientation.
Any advice on the best way to go about this?

Réponses (1)

Nirupama Nagarathinam
Nirupama Nagarathinam le 3 Mar 2023
Refer to the following sample code:
latlim = [42.2966508472710 42.3053796253471];
lonlim = [-71.3800315706306 -71.3639383165411];
ortho = wmsfind('usgsimageryonly', SearchField='serverurl');
[lakeside, lakesidereference] = wmsread(ortho, latlim=latlim, lonlim=lonlim);
f=figure;% craetaes a figure object
ax1=axes(f);% adds an axes object to figure
geoshow(ax1,lakeside, lakesidereference)%loads map on ax1
axis tight
ax2=axes(f); %creates a new axes on the same figure
ax2.Position=[0.47 0.47 0.08 0.08]; %sets the position of the new axes and its length and width
image(ax2,imread("boat-toy-cartoon-sticker-white-background_1308-79542.jpg")); %reads the required image and places it on the new axes
ax2.XTickLabel={};%removes the x tick labels
ax2.YTickLabel={};%removes the y tick labels
Here, I have added a new axes in the same figure and loaded the image on that axes.
Refer to the follwing document to undertsand about the "Position" property of axes:

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by