How can I adjust the patch function to display correctly?

조회 수: 4 (최근 30일)
Alysha Curtis
Alysha Curtis 2021년 11월 26일
편집: Walter Roberson 2021년 11월 26일
I want to display Wetlands data from the US Fish and Wildlife Service Wetlands Mapping page but I have been running in circles trying to figure out how to map it. I've gotten a display from using patch, but it is clearly incorrect. I do have multiple polygons, but again, not sure how to get them to display correctly. When I try geoshow('CA_Riparian.shp') I get nothing. Could someone help me modify my patch function to get it to display properly? The data can be found here: https://www.fws.gov/wetlands/Data/Data-Download.html
gx = geoaxes;
cali = shaperead('usastatehi.shp', 'UseGeoCoords', true, 'Selector',{@(name) strcmpi(name, 'California'), 'Name'});
lat = cali.Lat;
lon = cali.Lon;
geoplot(gx, lat,lon)
geobasemap(gx,'landcover')
land = shaperead('CA_Riparian.shp', 'UseGeoCoords',true);
ax2 = axes;
latW = land.Lat;
lonW = land.Lon;
patch(ax2,latW,lonW,'red','FaceAlpha',.4)
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
Thank you!

답변 (1개)

Steven Lord
Steven Lord 2021년 11월 26일
I'm not sure patch is the right tool for this job. Have you tried using geoplot or perhaps patchm from Mapping Toolbox instead?
  댓글 수: 1
Alysha Curtis
Alysha Curtis 2021년 11월 26일
I have, but with geoplot I run into this error:
Error using geoplot(line85)
Expected lat to be an array with all of the values <= 90.
Here's a snippet from my structure and workspace, not too sure how to restrict the size to maybe fix it?
With patchm it struggles with my axes. I have tried taking them off but if I do, it doesn't have any sort of display, only the basemap.

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

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by