필터 지우기
필터 지우기

Label Polygons in Mapshow

조회 수: 7 (최근 30일)
CMatlabWold
CMatlabWold 2020년 5월 24일
댓글: CMatlabWold 2020년 5월 28일
Hi
I have a shapefile of zip codes of NYC. When I use the code, I get this pic and a structure is created, where zip codes are listed in column 5 of the structure. How can I label these zip codes on the map, where it shows?
Thanks,
Candace
%S = shaperead('ZipCode1.shp','UseGeoCoords',true);
S = shaperead('ZipCode1.shp')
mapshow(S)
  댓글 수: 1
CMatlabWold
CMatlabWold 2020년 5월 27일
Thank you! It works. Is there a way to reduce the text size?

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

채택된 답변

Sai Sri Pathuri
Sai Sri Pathuri 2020년 5월 26일
편집: Sai Sri Pathuri 2020년 5월 26일
You may find internal point of bounding boxes and use text function.
for i=1:263
meanValue = mean(S(i).BoundingBox);
text(meanValue(1),meanValue(2),num2str(S(i).ZIPCODE))
end
  댓글 수: 2
Sai Sri Pathuri
Sai Sri Pathuri 2020년 5월 27일
To reduce text size, you may use FontSize name-value pair of text funtion
text(meanValue(1),meanValue(2),num2str(S(i).ZIPCODE),'FontSize',fontsize)
CMatlabWold
CMatlabWold 2020년 5월 28일
Thank you!

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by