필터 지우기
필터 지우기

Why scaleruler and northarrow functions cannot be used in mapshow figures

조회 수: 13 (최근 30일)
Songqiu
Songqiu 2022년 11월 12일
댓글: Songqiu 2022년 11월 21일
Hello everyone,
I just want to simply show scalebar and northarrow on my maps using the scaleruler and northarrow functions.
I tried the official help codes of MATLAB R2022a on mapshow as follows:
figure
mapshow boston.tif
S = shaperead('boston_roads.shp');
surveyFeetPerMeter = unitsratio('sf','meter');
x = surveyFeetPerMeter * [S.X];
y = surveyFeetPerMeter * [S.Y];
mapshow(x,y)
scaleruler on
northarrow
Then, I got the following errors:
Could you please tell me why and how to use scaleruler and northarrow on a mapshow figure?
Thanks a lot.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 11월 12일
When there is no existing axes then mapshow creates a standard numeric axes. mapshow is for displaying maps without projection, which is done on standard axes.
If, however, the existing axes is a mapping axes then mapshow can draw on it, but you need to avoid changing the map properties.
So you could axesm() mapshow() scaleruler... but you should consider using a function to display the map in a map axes instead of mapshow
  댓글 수: 7
Walter Roberson
Walter Roberson 2022년 11월 18일
scaleruler on
scaleruler('units', 'meter');
That is creating two scale rulers, one on the first call and one on the second call. Then handlem() is retrieving both of them, and setm() is giving an error because setm() is giving an error because it expects a scalar.
Remove the first of the calls to remove the error message.
Songqiu
Songqiu 2022년 11월 21일
Dear Walter,
Thank you very much for your reply.
Although the error did not come up anymore, I got the following bad results that are not I want.
The second one is that of adding [axis manual] after grid minor.
I do not find the scalebar and northarrow in the figure area, but find two additional items in the legend.
scaleruler and northarrow are difficult to use.
Thank you very much again for your patient answers.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by