필터 지우기
필터 지우기

Placing Image on GeographicAxes

조회 수: 19 (최근 30일)
Kevin Hickman
Kevin Hickman 2023년 2월 27일
답변: Nirupama Nagarathinam 2023년 3월 3일
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?

답변 (1개)

Nirupama Nagarathinam
Nirupama Nagarathinam 2023년 3월 3일
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:

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by