Plot polygons defined by the specific points on map
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
Hi, I'm using mapping toolbox to display some geographical data.
After plotting some lines using 'geoplot'; 'geoshow' or 'patchm' are not working.
How do I plot polygons in geographic coordinates?
I've tried this:
lats= [30 32 31; 29 30 31];
lons = [-102 -103 -104; -100 -103 -101];
geoplot([30 32], [-102 -104])
for i = size(lats,1)
    geoshow(lats(i,:),lons(i,:),'DisplayType','polygon');
end
And this is not what I want;
https://mathworks.com/matlabcentral/answers/487959-overlay-polygon-on-geographic-axes
Thank you for your help.
댓글 수: 0
답변 (1개)
  millercommamatt
      
 2021년 7월 8일
        There are many ways to do this, but this works.
lats= [30 32 31; 29 30 31];
lons = [-102 -103 -104; -100 -103 -101];
[numrows, ~] = size(lats);
usamap([28 33], [-105 -99]);  % create map axis
for ii=1:numrows
    patchesm(lats(ii,:),lons(ii,:),'b');  % blue polygons
end
댓글 수: 2
  millercommamatt
      
 2021년 7월 12일
				I think understand what you're trying to do now. You want to use geo plot types and non-geo plot types together.
The example that you said you didn't want, combined a GeographicAxes with a second hidden axis. I don't think you can combine use of the geo plot type and non-geo plot types any other way. A further complication is that the rulers of a GeographicAxes aren't linear. I don't know how you would get point in one axis to align with the other. Until Mathworks provide better cross compatability for working with GeographicAxes, I'd stick with map axes.
참고 항목
카테고리
				Help Center 및 File Exchange에서 Geographic Plots에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

